diff --git a/ChangeLog b/ChangeLog index 07bbb57f5dfbd802f21cc3799c2c57eac34cbdc9..3468a5b621fc9c5b017c4adcf9586eea501c59e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2030,4 +2030,9 @@ * tools/mkexport.sh: Extended the script that implements the top-level 'make export' logic. The script now also finds and bundles up all of the architecture-specific header files as well. - + * drivers/arch/arm/src/stm32/stm32_i2c.c: Add a reset to the I2C + initialization logic to prevent spurious interrups when the I2C + interrupts are enabled (submitted by Uros Platise). + * Scripts/makefiles/documents. Several adjustments, corrections and + typo fixes so that NuttX will build correctly on FreeBSD using the + ASH shell (submitted by Kurt Lidl). diff --git a/Documentation/README.html b/Documentation/README.html index aeb587dad0277ca4dd952362a273350d9b960f6d..4add4e665fd80833e8d13d25c037e009bdc2c5d2 100755 --- a/Documentation/README.html +++ b/Documentation/README.html @@ -28,6 +28,8 @@ | | |- arm | | | `- src | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/arch/arm/src/lpc214x/README.txt?view=log">lpc214x/README.txt</a> + | | |- avr/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/arch/avr/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- sh/ | | | |- include/ | | | | |-<a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/arch/sh/include/m16c/README.txt?view=log">m16c/README.txt</a> @@ -48,6 +50,8 @@ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/arch/z80/src/z80/README.txt?view=log">z80/README.txt</a> | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/arch/README.txt?view=log"><b><i>README.txt</i></b></a> | |- configs/ + | | |- amber/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/amber/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- avr32dev1/ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/avr32dev1/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- c5471evm/ @@ -56,6 +60,8 @@ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/c5471evm/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- demo9s12ne64/ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/demo9s12ne64/README.txt?view=log"><b><i>README.txt</i></b></a> + | | |- detron/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/detron/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- ea3131/ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/ea3131/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- eagle100/ @@ -73,6 +79,8 @@ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/ez80f910200zco/ostest/README.txt?view=log">ostest/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/ez80f910200zco/poll/README.txt?view=log">poll/README.txt</a> | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/ez80f910200zco/README.txt?view=log"><b><i>README.txt</i></b></a> + | | |- kwikstik-k40/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/kwikstik-k40/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- lm3s6965-ek/ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/lm3s6965-ek/include/README.txt?view=log">include/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/lm3s6965-ek/src/README.txt?view=log">src/README.txt</a> @@ -92,6 +100,8 @@ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/mcu123-lpc214x/include/README.txt?view=log">include/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/mcu123-lpc214x/src/README.txt?view=log">src/README.txt</a> | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/mcu123-lpc214x/README.txt?view=log"><b><i>README.txt</i></b></a> + | | |- micropendous3/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/micropendous3/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- mx1ads/ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/mx1ads/include/README.txt?view=log">include/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/mx1ads/src/README.txt?view=log">src/README.txt</a> @@ -120,14 +130,14 @@ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pjrc-8051/include/README.txt?view=log">include/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pjrc-8051/src/README.txt?view=log">src/README.txt</a> | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pjrc-8051/README.txt?view=log"><b><i>README.txt</i></b></a> - | | |- rgmp/ - | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/rgmp/include/README.txt?view=log">include/README.txt</a> - | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/rgmp/src/README.txt?view=log">src/README.txt</a> - | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/rgmp/README.txt?view=log"><b><i>README.txt</i></b></a> + | | |- qemu-i486/ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/qemu-i486/include/README.txt?view=log">include/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/qemu-i486/src/README.txt?view=log">src/README.txt</a> - | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/qemu-i486/README.txt?view=log"><b><i>README.txt</i></b></a> + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/qemu-i486/README.txt?view=log"><b><i>README.txt</i></b | | |- rgmp/ + | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/rgmp/include/README.txt?view=log">include/README.txt</a> + | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/rgmp/src/README.txt?view=log">src/README.txt</a> + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/rgmp/README.txt?view=log"><b><i>README.txt</i></b></a>></a> | | |- sam3u-ek/ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/sam3u-ek/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- sim/ @@ -143,6 +153,10 @@ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/stm3210e-eval/RIDE/README.txt?view=log">RIDE/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/stm3210e-eval/src/README.txt?view=log">src/README.txt</a> | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/stm3210e-eval/README.txt?view=log"><b><i>README.txt</i></b></a> + | | |- sure-pic32mx/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/sure-pic32mx/README.txt?view=log"><b><i>README.txt</i></b></a> + | | |- twr-k60n512/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/twr-k60n512/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- us7032evb1/ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/us7032evb1/bin/README.txt?view=log">bin/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/us7032evb1/include/README.txt?view=log">include/README.txt</a> @@ -189,20 +203,25 @@ | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/tools/README.txt?view=log"><b><i>README.txt</i></b></a> `- apps/ |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/README.txt?view=log"><b>README.txt</b></a> + |- examples/ + | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/examples/pashello/README.txt?view=log">pashello/README.txt</a> + | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/examples/README.txt?view=log"><b><i>README.txt</i></b></a> |- interpreters/ + | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/interpreters/ficl/README.txt?view=log"><b><i>ficl/README.txt</i></b></a> | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/interpreters/README.txt?view=log"><b><i>README.txt</i></b></a> |- netutils/ + | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/netutils/ftpc/README.txt?view=log">ftpc/README.txt</a> | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/netutils/telnetd/README.txt?view=log">telnetd/README.txt</a> | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/netutils/README?view=log"><b><i>README</i></b></a> |- nshlib/ | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/nshlib/README.txt?view=log"><b><i>README.txt</i></b></a> - |- examples/ - | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/examples/pashello/README.txt?view=log">pashello/README.txt</a> - | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/examples/README.txt?view=log"><b><i>README.txt</i></b></a> + |- system/ + | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/system/free/README.txt?view=log">free/README.txt</a> + | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/system/install/README.txt?view=log">install/README.txt</a> `- vsn/ - |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/vsn/free/README.txt?view=log">free/README.txt</a> |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/vsn/hello/README.txt?view=log">hello/README.txt</a> |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/vsn/poweroff/README.txt?view=log">poweroff/README.txt</a> |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/vsn/ramtron/README.txt?view=log">ramtron/README.txt</a> |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/vsn/sdcard/README.txt?view=log">sdcard/README.txt</a> + |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/vsn/sysinfo/README.txt?view=log">sysinfo/README.txt</a> `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/apps/vsn/sdcard/README.txt?view=log"><b><i>README.txt</i></b></a> diff --git a/Makefile b/Makefile index dcb4714300487cfebb9f95d5e81357d2ef780375..a298645e17c79ce5faf8b79e4cb3b8414b8ec4b5 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ NUTTX_ADDONS := $(NX_DIR) USER_ADDONS := ifeq ($(CONFIG_NUTTX_KERNEL),y) -USER_ADDONS += $(APPDIR) +USER_ADDONS += $(APPDIR) else NUTTX_ADDONS += $(APPDIR) endif @@ -324,7 +324,7 @@ clean_context: check_context: @if [ ! -e ${TOPDIR}/.config -o ! -e ${TOPDIR}/Make.defs ]; then \ echo "" ; echo "Nuttx has not been configured:" ; \ - echo " cd tools; ./configure.sh <target>\n" ; echo "" ;\ + echo " cd tools; ./configure.sh <target>" ; echo "" ; \ exit 1 ; \ fi diff --git a/README.txt b/README.txt index c7a682551db2fe87ceab7c1f06708a463564e2e3..b728a411d479d45a10b5ecd42f02ef03c82a956d 100755 --- a/README.txt +++ b/README.txt @@ -2,9 +2,19 @@ README ^^^^^^ o Installation + - Installing Cygwin + - Download and Unpack + - Semi-Optional apps/ Package + - Installation Directories with Spaces in the Path + - A Note about Header Files o Configuring NuttX o Toolchains + - Cross-Development Toolchains + - NuttX Buildroot Toolchain + o Shells o Building NuttX + - Building + - Re-building o Documentation INSTALLATION @@ -51,7 +61,7 @@ Download and Unpack: match the various instructions in the documentation and some scripts in the source tree. -Semi-Optional apps/ package. +Semi-Optional apps/ Package: All NuttX libraries and example code used to be in included within the NuttX source tree. As of NuttX-6.0, this application code was @@ -66,7 +76,7 @@ Semi-Optional apps/ package. Download the unpack the apps tarball in the same directly where you unpacked the NuttX tarball. After you unpack the apps tarball, you - will have a new directory called apps-versioin (where the version + will have a new directory called apps-version (where the version should exactly match the version of the NuttX tarball). Again, you might want to rename the directory to simply apps/ to match what you read in the documentation @@ -81,10 +91,10 @@ Semi-Optional apps/ package. This is important because the NuttX build will expect to find the apps directory in that (default) location. )That default location - can be changed by editting your NuttX configuration file, but that + can be changed by editing your NuttX configuration file, but that is another story). -Installation Directories with Spaces in the Path +Installation Directories with Spaces in the Path: The nuttx build directory should reside in a path that contains no spaces in any higher level directory name. For example, under @@ -187,6 +197,36 @@ NuttX Buildroot Toolchain This toolchain is available for both the Linux and Cygwin development environments. +SHELLS +^^^^^^ + + The NuttX build relies on some shell scripts. Some are inline in the + Makefiles and many are exectuble scripts in the tools/. directory. The + scripts were all developed using bash and many contain bash shell + dependencies. + + Most of the scripts begin with #!/bin/bash to specifically select the + bash shell. Some still have #!/bin/sh but I haven't heard any complaints + so these must not have bash dependencies. + + There are two shell issues that I have heard of: + + 1. Linux where /bin/sh refers to an incompatible shell (like ksh or csh). + + In this case, bash is probably avaiable and the #!/bin/bash at the + beginning of the file should do the job. If any scripts with #!/bin/sh + fail, try changing that ti #!/bin/bash and let me know about the change. + + 2. FreeBSD with the Bourne Shell and no bash shell. + + The other, reverse case has also been reported on FreeBSD setups that + have the Bourne shell, but not bash. In this base, #!/bin/bash fails + but #!/bin/sh works okay. My recommendation in this case is to create + a symbolic link at /bin/bash that refers to the Bourne shell. + + There may still be issues, however, with certain the bash-centric scripts + that will require modifications. + BUILDING NUTTX ^^^^^^^^^^^^^^ @@ -196,7 +236,7 @@ Building any special build directories. Assuming that your Make.defs is setup properly for your tool chain and that setenv.sh contains the path to where your cross-development tools are installed, the following steps are all that - are equired to build NuttX: + are required to build NuttX: cd ${TOPDIR} . ./setenv.sh @@ -226,16 +266,16 @@ Re-building make clean_context all - This 'make' coimmand will remove of the copied directories, re-copy them, + This 'make' command will remove of the copied directories, re-copy them, then make NuttX. CYGWIN BUILD PROBLEMS ^^^^^^^^^^^^^^^^^^^^^ -If you see strange behaviour when building under Cygwin then you may have +If you see strange behavior when building under Cygwin then you may have a problem with your PATH variable. For example, if you see failures to locate files that are clearly present, that may mean that you are using -the wrong version of a tool. For example, you may not be using Cywgin's +the wrong version of a tool. For example, you may not be using Cygwin's 'make' program at /usr/bin/make. Try: $ which make @@ -268,12 +308,15 @@ NuttX documentation is also available online at http://www.nuttx.org. Below is a guide to the available README files in the NuttX source tree: +nuttx | |- arch/ | | - | |- arm + | |- arm/ | | `- src | | `- lpc214x/README.txt + | |- avr/ + | | `- README.txt | |- sh/ | | |- include/ | | | |-m16c/README.txt @@ -294,6 +337,8 @@ Below is a guide to the available README files in the NuttX source tree: | | `- z80/README.txt | `- README.txt |- configs/ + | |- amber/ + | | `- README.txt | |- avr32dev1/ | | `- README.txt | |- c5471evm/ @@ -302,6 +347,8 @@ Below is a guide to the available README files in the NuttX source tree: | | `- README.txt | |- demo0s12ne64/ | | `- README.txt + | |- detron/ + | | `- README.txt | |- ea3131/ | | `- README.txt | |- eagle100/ @@ -319,6 +366,8 @@ Below is a guide to the available README files in the NuttX source tree: | | |- ostest/README.txt | | |- poll/README.txt | | `- README.txt + | |- kwikstik-k40/ + | | `- README.txt | |- lm3s6965-ek/ | | |- include/README.txt | | |- src/README.txt @@ -338,6 +387,8 @@ Below is a guide to the available README files in the NuttX source tree: | | |- include/README.txt | | |- src/README.txt | | `- README.txt + | |- micropendous3/ + | | `- README.txt | |- mx1ads/ | | |- include/README.txt | | |- src/README.txt @@ -349,7 +400,7 @@ Below is a guide to the available README files in the NuttX source tree: | | |- include/README.txt | | |- src/README.txt | | `- README.txt - | |- nucleus1g/ + | |- nucleus2g/ | | `- README.txt | |- olimex-lpc1766stk/ | | `- README.txt @@ -366,11 +417,11 @@ Below is a guide to the available README files in the NuttX source tree: | | |- include/README.txt | | |- src/README.txt | | `- README.txt - | |- rgmp/ + | |- qemu-i486/ | | |- include/README.txt | | |- src/README.txt | | `- README.txt - | |- qemu-i486/ + | |- rgmp/ | | |- include/README.txt | | |- src/README.txt | | `- README.txt @@ -389,6 +440,10 @@ Below is a guide to the available README files in the NuttX source tree: | | |- RIDE/README.txt | | |- src/README.txt | | `- README.txt + | |- sure-pic32mx/ + | | `- README.txt + | |- twr-k60n512/ + | | `- README.txt | |- us7032evb1/ | | |- bin/README.txt | | |- include/README.txt @@ -418,9 +473,6 @@ Below is a guide to the available README files in the NuttX source tree: | `- README.txt |- drivers/ | `- README.txt - |- examples/ - | |- pashello/README.txt - | `- README.txt |- fs/ | |- mmap/ | | `- README.txt @@ -436,3 +488,35 @@ Below is a guide to the available README files in the NuttX source tree: | `- README.txt `- tools/ `- README.txt + +apps + |- examples/ + | |- pashello/README.txt + | `- README.txt + |- interpreters/ + | |- ficl + | | `- README.txt + | `- README.txt + |- netutils/ + | |- ftpc + | | `- README.txt + | |- telnetd + | | `- README.txt + | `- README.txt + |- nshlib/ + | `- README.txt + |- system/ + | |- free/README.txt + | `- install + | `- README.txt + |- vsn/ + | |- hello/README.txt + | |- poweroff + | | `- README.txt + | |- ramtron + | | `- README.txt + | |- sdcard + | | `- README.txt + | `- sysinfo + | `- README.txt + `- README.txt diff --git a/arch/arm/src/stm32/stm32_i2c.c b/arch/arm/src/stm32/stm32_i2c.c index 91a0aca34dc9320bae5fe5aed9db692199173cbe..2eff0cea4682f62e5ecf4b5f95a038ea810045aa 100644 --- a/arch/arm/src/stm32/stm32_i2c.c +++ b/arch/arm/src/stm32/stm32_i2c.c @@ -129,14 +129,26 @@ struct stm32_i2c_inst_s { #if CONFIG_STM32_I2C1 struct stm32_i2c_priv_s stm32_i2c1_priv = { .base = STM32_I2C1_BASE, - .refs = 0 + .refs = 0, + .msgc = 0, + .msgv = NULL, + .ptr = NULL, + .dcnt = 0, + .flags = 0, + .status = 0 }; #endif #if CONFIG_STM32_I2C2 struct stm32_i2c_priv_s stm32_i2c2_priv = { .base = STM32_I2C2_BASE, - .refs = 0 + .refs = 0, + .msgc = 0, + .msgv = NULL, + .ptr = NULL, + .dcnt = 0, + .flags = 0, + .status = 0 }; #endif @@ -443,13 +455,24 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) #if CONFIG_STM32_I2C1 case STM32_I2C1_BASE: - modifyreg32(STM32_RCC_APB1ENR, 0, RCC_APB1ENR_I2C1EN); + + /* enable power and reset the peripheral */ + + modifyreg32(STM32_RCC_APB1ENR, 0, RCC_APB1ENR_I2C1EN); + + modifyreg32(STM32_RCC_APB1RSTR, 0, RCC_APB1RSTR_I2C1RST); + modifyreg32(STM32_RCC_APB1RSTR, RCC_APB1RSTR_I2C1RST, 0); + + /* configure pins */ if (stm32_configgpio(GPIO_I2C1_SCL)==ERROR) return ERROR; if (stm32_configgpio(GPIO_I2C1_SDA)==ERROR) { stm32_unconfiggpio(GPIO_I2C1_SCL); return ERROR; } + + /* attach ISRs */ + irq_attach(STM32_IRQ_I2C1EV, stm32_i2c1_isr); irq_attach(STM32_IRQ_I2C1ER, stm32_i2c1_isr); up_enable_irq(STM32_IRQ_I2C1EV); @@ -459,13 +482,24 @@ static int stm32_i2c_init(FAR struct stm32_i2c_priv_s *priv) #if CONFIG_STM32_I2C2 case STM32_I2C2_BASE: + + /* enable power and reset the peripheral */ + modifyreg32(STM32_RCC_APB1ENR, 0, RCC_APB1ENR_I2C2EN); + + modifyreg32(STM32_RCC_APB1RSTR, 0, RCC_APB1RSTR_I2C2RST); + modifyreg32(STM32_RCC_APB1RSTR, RCC_APB1RSTR_I2C2RST, 0); + + /* configure pins */ if (stm32_configgpio(GPIO_I2C2_SCL)==ERROR) return ERROR; if (stm32_configgpio(GPIO_I2C2_SDA)==ERROR) { stm32_unconfiggpio(GPIO_I2C2_SCL); return ERROR; } + + /* attach ISRs */ + irq_attach(STM32_IRQ_I2C2EV, stm32_i2c2_isr); irq_attach(STM32_IRQ_I2C2ER, stm32_i2c2_isr); up_enable_irq(STM32_IRQ_I2C2EV); @@ -748,7 +782,7 @@ FAR struct i2c_dev_s * up_i2cinitialize(int port) return NULL; #endif - /* Get structure and enable power */ + /* Get I2C private structure */ switch(port) { #if CONFIG_STM32_I2C1 diff --git a/arch/x86/src/Makefile b/arch/x86/src/Makefile index e0e92eacddee1c49aa9e72aeb84f3ce6fef3f654..6be4053afdbf63c81af320f72fca89a0cc577e60 100644 --- a/arch/x86/src/Makefile +++ b/arch/x86/src/Makefile @@ -81,6 +81,14 @@ BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board LIBGCC = "${shell $(CC) -print-libgcc-file-name}" +ifeq ($(HOSTOS),FreeBSD) + HOST_ARCH = ${shell uname -m 2>/dev/null || echo "Other"} + ifeq ($(HOST_ARCH),amd64) + LDFLAGS += -melf_i386 + LIBGCC = "/usr/lib32/libgcc.a" + endif +endif + VPATH = chip:common:$(ARCH_SUBDIR) all: $(HEAD_OBJ) libarch$(LIBEXT) diff --git a/syscall/README.txt b/syscall/README.txt index 42ef78b1f752a3ae39d7c184c91b1f5d85c7ea07..0b77f50bfcf960959b1e79eacee7c9e7d676d867 100644 --- a/syscall/README.txt +++ b/syscall/README.txt @@ -1,95 +1,95 @@ -sycall/README.txt -================= - -This directory supports a syscall layer from communication between a -monolithic, kernel-mode NuttX kernel and a separately built, user-mode -application set. - -With most MCUs, NuttX is built as a flat, single executable image -containing the NuttX RTOS along with all application code. The RTOS code -and the application run in the same address space and at the same kernel- -mode privileges. In order to exploit security features of certain -processors, an alternative build model is also supported: NuttX can -be built separately as a monolithic, kernel-mode module and the applications -can be added as a separately built, user-mode module. - -The syscall layer provided in this directory serves as the communication -layer from the user-mode application into the kernel-mode RTOS. The -switch from user-mode to kernel-mode is accomplished using software -interrupts (SWIs). SWIs are implemented differently and named differently -by different manufacturers but all work essentially the same: A special -instruction is executed in user-mode that causes a software generated -interrupt. The software generated interrupt is caught within the kernel -and handle in kernel-mode. - -Header Files -============ - -include/syscall.h - - This header file supports general access to SWI facilities. It is simply - a wrapper file that includes include/sys/syscall.h and - include/arch/syscall.h. - -include/sys/syscall.h - - The SWIs received by the kernel are distinguish by a code that identifies - how to process the SWI. This header file defines all such codes understood - by the NuttX kernel. - -include/arch/syscall.h (or arch/<cpu>/include/syscall.h) - - This header file is provided by the platform-specific logic and declares - (or defines) the mechanism for providing software interrupts on this - platform. The following functions must be declared (or defined) in this - header file: - - - SWI with SYS_ call number and one parameter - - uintptr_t sys_call0(unsigned int nbr); - - - SWI with SYS_ call number and one parameter - - uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1); - - - SWI with SYS_ call number and two parameters - - uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1, uintptr_t parm2); - - - SWI with SYS_ call number and three parameters - - uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1, - uintptr_t parm2, uintptr_t parm3); - - - SWI with SYS_ call number and four parameters - - uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3, uintptr_t parm4); - - - SWI with SYS_ call number and five parameters - - uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3, uintptr_t parm4, uintptr_t parm5); - - - SWI with SYS_ call number and six parameters - - uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, - uintptr_t parm6); -Syscall Database -================ - -Sycall information is maintained in a database. That "database" is -implemented as a simple comma-separated-value file, syscall.csv. Most -spreadsheets programs will accept this format and can be used to maintain -the syscall database. - -The format of the CSV file for each line is: - - Field 1: Function name - Field 2: The header file that contains the function prototype - Field 3: Condition for compilation - Field 4: The type of function return value. +syscall/README.txt +================== + +This directory supports a syscall layer from communication between a +monolithic, kernel-mode NuttX kernel and a separately built, user-mode +application set. + +With most MCUs, NuttX is built as a flat, single executable image +containing the NuttX RTOS along with all application code. The RTOS code +and the application run in the same address space and at the same kernel- +mode privileges. In order to exploit security features of certain +processors, an alternative build model is also supported: NuttX can +be built separately as a monolithic, kernel-mode module and the applications +can be added as a separately built, user-mode module. + +The syscall layer provided in this directory serves as the communication +layer from the user-mode application into the kernel-mode RTOS. The +switch from user-mode to kernel-mode is accomplished using software +interrupts (SWIs). SWIs are implemented differently and named differently +by different manufacturers but all work essentially the same: A special +instruction is executed in user-mode that causes a software generated +interrupt. The software generated interrupt is caught within the kernel +and handle in kernel-mode. + +Header Files +============ + +include/syscall.h + + This header file supports general access to SWI facilities. It is simply + a wrapper file that includes include/sys/syscall.h and + include/arch/syscall.h. + +include/sys/syscall.h + + The SWIs received by the kernel are distinguish by a code that identifies + how to process the SWI. This header file defines all such codes understood + by the NuttX kernel. + +include/arch/syscall.h (or arch/<cpu>/include/syscall.h) + + This header file is provided by the platform-specific logic and declares + (or defines) the mechanism for providing software interrupts on this + platform. The following functions must be declared (or defined) in this + header file: + + - SWI with SYS_ call number and one parameter + + uintptr_t sys_call0(unsigned int nbr); + + - SWI with SYS_ call number and one parameter + + uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1); + + - SWI with SYS_ call number and two parameters + + uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1, uintptr_t parm2); + + - SWI with SYS_ call number and three parameters + + uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1, + uintptr_t parm2, uintptr_t parm3); + + - SWI with SYS_ call number and four parameters + + uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3, uintptr_t parm4); + + - SWI with SYS_ call number and five parameters + + uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3, uintptr_t parm4, uintptr_t parm5); + + - SWI with SYS_ call number and six parameters + + uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, + uintptr_t parm6); +Syscall Database +================ + +Sycall information is maintained in a database. That "database" is +implemented as a simple comma-separated-value file, syscall.csv. Most +spreadsheets programs will accept this format and can be used to maintain +the syscall database. + +The format of the CSV file for each line is: + + Field 1: Function name + Field 2: The header file that contains the function prototype + Field 3: Condition for compilation + Field 4: The type of function return value. Field 5 - N+5: The type of each of the N formal parameters of the function Each type field has a format as follows: @@ -106,38 +106,38 @@ Each type field has a format as follows: a union sigval, but you can cast to the type of one of the union member types when passing the actual paramter. Similarly, we cannot cast a union sigval to a uinptr_t either. Rather, we need - to cast a specific union member fieldname to uintptr_t. - -Auto-Generated Files -==================== - -Stubs and proxies for the sycalls are automatically generated from this CSV -database. Here the following definition is used: - - Proxy - A tiny bit of code that executes in the user space. A proxy - has exactly the same function prototype as does the "real" function - for which it proxies. However, it only serves to map the function - call into a syscall, marshaling all of the system call parameters - as necessary. - - Stub - Another tiny bit of code that executes within the NuttX kernel - that is used to map a software interrupt received by the kernel to - a kernel function call. The stubs receive the marshaled system - call data, and perform the actually kernel function call (in - kernel-mode) on behalf of the proxy function. - -Sub-Directories -=============== - - stubs - Autogenerated stub files are placed in this directory. - proxies - Autogenerated proxy files are placed in this directory. - -mksyscall -========= - - mksyscall is C program that is used used during the initial NuttX build - by the logic in the top-level syscall/ directory. Information about the - stubs and proxies is maintained in a comma separated value (CSV) file - in the syscall/ directory. The mksyscall program will accept this CVS - file as input and generate all of the required proxy or stub files as - output. See tools/README.txt for additional information. + to cast a specific union member fieldname to uintptr_t. + +Auto-Generated Files +==================== + +Stubs and proxies for the sycalls are automatically generated from this CSV +database. Here the following definition is used: + + Proxy - A tiny bit of code that executes in the user space. A proxy + has exactly the same function prototype as does the "real" function + for which it proxies. However, it only serves to map the function + call into a syscall, marshaling all of the system call parameters + as necessary. + + Stub - Another tiny bit of code that executes within the NuttX kernel + that is used to map a software interrupt received by the kernel to + a kernel function call. The stubs receive the marshaled system + call data, and perform the actually kernel function call (in + kernel-mode) on behalf of the proxy function. + +Sub-Directories +=============== + + stubs - Autogenerated stub files are placed in this directory. + proxies - Autogenerated proxy files are placed in this directory. + +mksyscall +========= + + mksyscall is C program that is used used during the initial NuttX build + by the logic in the top-level syscall/ directory. Information about the + stubs and proxies is maintained in a comma separated value (CSV) file + in the syscall/ directory. The mksyscall program will accept this CVS + file as input and generate all of the required proxy or stub files as + output. See tools/README.txt for additional information. diff --git a/tools/mkdeps.sh b/tools/mkdeps.sh index 0aec5dba8f903ee41c701fc84f14cb877ec2c238..6d83f2ca01073395b3a697222d645d826894850d 100755 --- a/tools/mkdeps.sh +++ b/tools/mkdeps.sh @@ -1,8 +1,8 @@ #!/bin/bash ############################################################################ -# tools mkdeps.sh +# tools/mkdeps.sh # -# Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <spudmonkey@racsa.co.cr> # # Redistribution and use in source and binary forms, with or without @@ -34,12 +34,10 @@ # ############################################################################ -WD= - # # Usage: -function show_usage () +show_usage () { echo "" echo "$progname [OPTIONS] CC -- CFLAGS -- file [file [file...]]" @@ -69,7 +67,7 @@ function show_usage () exit 1 } -function dodep () +dodep () { unset fullpath if [ -z "$altpath" ]; then @@ -94,7 +92,7 @@ function dodep () fi $cc -M $cflags $fullpath || \ - { echo "# ERROR: $cc -M $cflags $fullpath FAILED" ; exit 4 ; } + ( echo "# ERROR: $cc -M $cflags $fullpath FAILED"; exit 4; ) } unset cc