Sheref Younan | 3 May 2011 20:36
Picon

bug : incorrect directory entry update in fat_sync

 

The function fat_sync() (fs_fat32.c) updates a file state in the fat filesystem, this includes writing some metadata in its relevant directory entry. 

the expression used to get directory entry buffer is :

         direntry = &fs->fs_buffer[ff->ff_dirindex * 32];

however this expression is invalid if ff_dirindex points beyond the first sector.

the expression should be :

         direntry = &fs->fs_buffer[(ff->ff_dirindex & DIRSEC_NDXMASK(fs)) * 32];


Regards,
Sheref Younan

__._,_.___
Recent Activity:
.

__,_._,___
Sheref Younan | 3 May 2011 21:03
Picon

the ret variable is not updated in all paths of fat_mount() [1 Attachment]

 
[Attachment(s) from Sheref Younan included below]

in the function fat_mount() (fs_fat32util.c) :

      The variable "ret" is not set with the return value of fat_checkbootrecord()

attached a patch file with suggested fixes, this patch is made against Nuttx release 6.0

Regards,
Sheref Younan
__._,_.___

Attachment(s) from Sheref Younan

1 of 1 File(s)

Recent Activity:
.

__,_._,___
Gregory N | 4 May 2011 00:34
Picon
Favicon
Gravatar

Re: the ret variable is not updated in all paths of fat_mount()

 



Thanks, Sheref,

I always appreciate bug reports -- and even more if they include the fixes! I have incorporated both of your changes in SVN but have not yet done any verification:

> The variable "ret" is not set with the return value
> of fat_checkbootrecord()
> ..

And

> the expression used to get directory entry buffer is :
>
> direntry = &fs->fs_buffer[ff->ff_dirindex * 32];
>
> however this expression is invalid if ff_dirindex points beyond the first sector.
>
>the expression should be :
>
> direntry = &fs->fs_buffer[(ff->ff_dirindex & DIRSEC_NDXMASK(fs)) * 32];

File systems are difficult to verify. My test cases are pretty limited and I develop an OS not the applications that run on top of the OS, so sometimes only those bigger applications can find bugs that my little test suites cannot.

Also, FYI, I am now writing a new file system that I am calling NXFFS for NuttX FLASH file system. It is a tiny (hopefully), wear leveling FLASH file system that is tuned and integrated with NuttX.

I hope to release the first version of NXFFS (with NuttX-6.2) near the end of this week.

Greg

__._,_.___
Recent Activity:
.

__,_._,___
Sheref Younan | 4 May 2011 00:53
Picon

Re: Re: the ret variable is not updated in all paths of fat_mount()

 

well, with enough eyeballs all bugs are shallow :)

and nuttx definitely deserves lots of eyeballs around it

Sheref

On Wed, May 4, 2011 at 1:34 AM, Gregory N <spudarnia-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:
 



Thanks, Sheref,

I always appreciate bug reports -- and even more if they include the fixes! I have incorporated both of your changes in SVN but have not yet done any verification:



> The variable "ret" is not set with the return value
> of fat_checkbootrecord()
> ..

And

> the expression used to get directory entry buffer is :
>
> direntry = &fs->fs_buffer[ff->ff_dirindex * 32];
>
> however this expression is invalid if ff_dirindex points beyond the first sector.
>
>the expression should be :
>
> direntry = &fs->fs_buffer[(ff->ff_dirindex & DIRSEC_NDXMASK(fs)) * 32];

File systems are difficult to verify. My test cases are pretty limited and I develop an OS not the applications that run on top of the OS, so sometimes only those bigger applications can find bugs that my little test suites cannot.

Also, FYI, I am now writing a new file system that I am calling NXFFS for NuttX FLASH file system. It is a tiny (hopefully), wear leveling FLASH file system that is tuned and integrated with NuttX.

I hope to release the first version of NXFFS (with NuttX-6.2) near the end of this week.

Greg


__._,_.___
Recent Activity:
.

__,_._,___
andrew_tholt | 6 May 2011 11:17
Picon
Favicon

First time build problem

 

Hi,

I am building NuttX on cygwin for the target stm3210e-eval/RIDE

I do the following ....

cd tools
./configure.sh stm3210e-eva/RIDE
. setenv.sh
make

And the build starts, after a few minutes it fails with:

C:\Program Files\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-ld.exe: cannot open linker script file C:\Documents and Settings\andrewhh\My Documents\Source\nuttx-6.1\configs\stm3210e-eval\RIDE\ld.script: Invalid argument
make[1]: *** [nuttx] Error 1
make[1]: Leaving directory `/cygdrive/c/Documents and Settings/andrewhh/My Documents/Source/nuttx-6.1/arch/arm/src'
make: *** [pass2] Error 2

Am I doing something wrong, is something missing ?

Thanks,
Andrew

__._,_.___
Recent Activity:
.

__,_._,___
andrew_tholt | 6 May 2011 16:08
Picon
Favicon

Another first time build problem

 

Hi,

I have built buildroot (Ver 1.9) and I am attempting to build NuttX 6.1.

I do the following

cd tools
./configure.sh stm3210e-eval/ostest
cd ..
make

... lots of build stuff ...

Then:

AR: up_deselectsram.o
make[2]: Leaving directory `/home/andrewh/Source/nuttx-6.1/configs/stm3210e-eval/src'
LD: nuttx
/home/andrewh/Source/nuttx/sched//libsched.a(os_bringup.o): In function `os_bringup':
os_bringup.c:(.text+0x30): undefined reference to `user_start'
make[1]: *** [nuttx] Error 1
make[1]: Leaving directory `/home/andrewh/Source/nuttx-6.1/arch/arm/src'
make: *** [pass2] Error 2

What am I missing ?

Thanks,
Andrew

__._,_.___
Recent Activity:
.

__,_._,___
andrew_tholt | 6 May 2011 16:23
Picon
Favicon

Re: Another first time build problem (undefined reference to `user_start')

 

Sorry, I know its bad form to reply to your own message :)

I have done a liitle more investigations, and I thing I've fixed it. I'll outline what I did and what I found in case its of help to anybody else.

grep user_start `find . -name "*.c"`

Returns

./drivers/usbhost/usbhost_hidkbd.c: uvdbg("user_start: Start poll task\n");
./sched/os_bringup.c: * then the default entry point is user_start.
./sched/os_bringup.c:# define USER_ENTRYPOINT user_start

and

grep user_start `find . -name "*.h"`

Returns

./include/nuttx/init.h:EXTERN int user_start(int argc, char *argv[]);

So it appears to me that the function user_start is not defined.

I unpacked the apps archive, and in the apps directory dif:

grep user_start `find . -name "*.c"` | grep nsh

and

./examples/nsh/nsh_main.c: * Name: user_start
./examples/nsh/nsh_main.c:int user_start(int argc, char *argv[])

So I did

cd nuttx
make clean
cd tools ; ./configure.sh stm3210e-eval/nsh ; cd ..
make

.... and after a little time ..

-rw-r--r-- 1 andrewh andrewh 18124 2011-05-06 10:16 System.map
-rw-r--r-- 1 andrewh andrewh 169342 2011-05-06 10:16 nuttx.ihx
-rwxr-xr-x 1 andrewh andrewh 156188 2011-05-06 10:16 nuttx

HTH

Andrew

--- In nuttx-hHKSG33TihhbjbujkaE4pw@public.gmane.org, "andrew_tholt" <andrew_tholt <at> ...> wrote:
>
> Hi,
>
> I have built buildroot (Ver 1.9) and I am attempting to build NuttX 6.1.
>
> I do the following
>
> cd tools
> ./configure.sh stm3210e-eval/ostest
> cd ..
> make
>
> ... lots of build stuff ...
>
> Then:
>
> AR: up_deselectsram.o
> make[2]: Leaving directory `/home/andrewh/Source/nuttx-6.1/configs/stm3210e-eval/src'
> LD: nuttx
> /home/andrewh/Source/nuttx/sched//libsched.a(os_bringup.o): In function `os_bringup':
> os_bringup.c:(.text+0x30): undefined reference to `user_start'
> make[1]: *** [nuttx] Error 1
> make[1]: Leaving directory `/home/andrewh/Source/nuttx-6.1/arch/arm/src'
> make: *** [pass2] Error 2
>
> What am I missing ?
>
> Thanks,
> Andrew
>

__._,_.___
Recent Activity:
.

__,_._,___
Gregory Nutt | 6 May 2011 18:41
Picon
Favicon
Gravatar

Re: Re: Another first time build problem (undefined reference to `user_start')

 

Hi, Andrew,

Sorry to be slow to respond.  Actually, I was waiting to have access to a machine that I can build on.  I am glad you are not using that st3210e-eval/RIDE configuration -- that was just used to debug the STM32 startup code and hasn't been used in a long time and probably now has some errors  from a long time with no use.  It really isn't worth investing too much of your time on.

The stm3210e-eval/ostest configuration is critical, however, because this is the test that proves that you have a working OS on your platf orm (otherwise is it not very interesting either).

It sounds like you have solved the build issues.  There is some discussion of the this build issue in the top-level README.txt file under the title "Semi-Optional apps/ package."

Greg


__._,_.___
Recent Activity:
.

__,_._,___
Gregory N | 6 May 2011 21:37
Picon
Favicon
Gravatar

Buildroot 1.10 Released

 

Today, May 6, 2011, I released version 1.10 of the customized buildroot for NuttX. Downloads and release notes are available here: https://sourceforge.net/projects/nuttx/files/buildroot/buildroot-1.10/

ReleaseNotes v0.1.10
====================

This is a highly hacked up version of the buildroot (see
http://buildroot.uclibc.org/). It has been hacked so that it
can be used to build the following NuttX-compatible toolchains:

* arm-elf toolchain needed for use with the TI C5471 (ARM7TDMI),
NXP LPC214x (ARM7TMDI), STMicro STR71x (ARM7TDMI), Freescale
i.MX1 (ARM920T), and TI DM320 (ARM926EJ-S) provided with the
NuttX releases.

NXFLAT toolchain for use with the ARM7 and ARM9.

* arm-elf ARM Cortex-M3 (thumb2) toolchain needed for use with
the Luminary LM3Sxxx, NXP 17xxxx, Atmel SAM3u, and STMicor
STM32 ports provided with the NuttX releases.
NXFLAT toolchain for use with the ARM Cortex-M3.

* avr-elf toolchain needed for use with the ATmega128 ports
provided with the NuttX releases.

* H8/300 toolchain (not currently used in any NuttX
configuration).

* i486-elf toochain. Why would you want such a thing? On Linux, of
course, such a thing is not needed because you can use the installed GCC
to build i486 ELF binaries. But that will not work under Cygwin! The
Cygwin toolchain (and probably MinGW), build DOS MZ format executables
(i.e., .exe files). That is probably not usable for most NuttX targets.
Instead, you should use this i486-elf-gcc to generate true ELF binaries
under Cygwin.

* bfin-elf toolchain not currently used in any NuttX
configuration).

* m68k-elf toolchain (not currently used in any NuttX
configuration).

* m68hc11-elf toolchain (not currently used in any NuttX
configuration).

* m68hc12-elf toolchain. (NOT RECOMMENDED for hcs12;
Use m9s12x-elf toolchain)

* m9s12x-elf toolchain Supports Freescale m9s12x using
binutils 2.18 and gcc 3.3.6 and patches available from
http://www.msextra.com/tools courtesy of James Cortina.

* m32c-elf toolchain needed for the Renesas M16C NuttX port.

* sh-elf toolchain needed for the SH-1 NuttX port.

Supported tool versions include:

* gcc-3.3.6 + binuils-2.18 (for m9s12x).
* gcc-3.4.6 + binutils-2.17
* gcc-4.2.4 + binutils-2.19
* gcc-4.3.3 + binutils-2.19.1
* gcc-4.5.2 + binutils-2.21

See the ChangeLog of features/architectures added in v0.1.10.

Installation instructions:

* You must have already configured Nuttx in <some-dir>/nuttx
* download the buildroot package into`<some-dir>
* unpack
* cd <some-dir>/buildroot
* cp configs/<config-file> .config
* make oldconfig
* make

See configs/README.txt for other configurations and for more detailed
instructions. If your NuttX installation resides at a different location
then:

* `make menuconfig`

And set the "Path to the NuttX root directory" appropriately.

NXFLAT Toolchain Build
----------------------

You can select to build the NXFLAT toolchain with GCC by selecting
the NXFLAT toolchin during the configuration process(you can also
select omit building GCC with and only build the NXFLAT toolchain
for use with your own GCC toolchain.

NFFLAT is only available for ARM and Cortex-M3 architectures.

ChangeLog
=========

buildroot-1.10 2011-05-06 <spudmonkey AT racsa.co.cr>
--------------------------------------------------

* Add patch submitted by Dimiter Georgiev to work around problems in building
GDB 6.8 with versions of Cygwin > 1.7.
* configs/i486-defconfig-4.3.3 - Builds an i486 cross development toolchain
using gcc 4.3.3. Why would you want such a thing? On Linux, of course,
such a thing is not needed because you can use the installed GCC to build
i486 ELF binaries. But that will not work under Cygwin! The Cygwin
toolchain (and probably MinGW), build DOS MZ format executables (i.e.,
.exe files). That is probably not usable for most NuttX targets.
Instead, you should use this i486-elf-gcc to generate true ELF binaries
under Cygwin.
* Makefile - Alter copy arguments to avoid permissions problems when
copying NuttX header files.
* toolchain/nxflat/nxflat.mk and Makefile - Fix include paths.
* toolchain/gcc/3.3.6 - Added a patch to fixed compilation error on Ubuntu
9.10.
* toolchain/nxflat/Makefile - Correct static library link order.
* configs/arm920t-defconfig-4.3.3 - Enable support for NXFLAT tools.
* toolchain/binutils/2.21 and toolchain/gcc/4.5.2 - Add support for GCC
4.5.2 with binutils 2.21.
* configs/arm920t-eabi-defconfig-4.5.2 - Add a configuration to build a
GCC 4.5.2 EABI ARM toolchain for the ARM920t.

__._,_.___
Recent Activity:
.

__,_._,___
Gregory N | 6 May 2011 21:39
Picon
Favicon
Gravatar

NuttX-6.2 Released

 

Today, May 6, 2001, I released version 6.2 of NuttX. The NuttX and apps packages are available from download from https://sourceforge.net/projects/nuttx/files/nuttx/nuttx-6.2/.

Release notes are available from the same location and below:

nuttx-6.2
=========

The 69th release of NuttX, Version 6.2, was made on May 6, 2011 and is
available for download from the SourceForge website. Note that release
consists of two tarballs: nuttx-6.2.tar.gz and apps-6.2.tar.gz. Both
are needed (see the top-level nuttx/README.txt file for build information)

The 6.2 release includes several new features:

* NXFFS: The obvious new feature is NXFFS, the NuttX wear-leveling
FLASH file system. This new file system is intended to be
small for the MCU usage and has some limitations. No formal
documentation of NXFFS yet exists. See the fs/nxffs/README.txt
file for details (available at
http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/fs/nxffs/README.txt?view=log)
* Support for NXP LPCXpresso LPC1768 board on the Embedded
Artists base board. The Code Red toolchain is supported under
either Linux or Windows. Verifed configurations include dhcpd,
nsh, nx, ostest, thttpd, and usbstorage.
* Support for the Univision UG-9664HSWAG01 OLED with Solomon
Systech SD1305 LCD controller.
* A new RAM MTD driver with FLASH simulation capability.
* A version.h file is now automatically generated so that C code
can now be version-aware.

In addition to these new feature, several important bugfixes are included
in this release correcting problems with dup2(), LPC17xx GPIO interrupts,
LPC17xx UART2/3, the FAT file system, build issues, and strrch(). See the
ChangeLog for more details.

ChangeLog
=========

6.2 2011-05-06 Gregory Nutt <spudmonkey AT racsa.co.cr>
-------------------------------------------------------

* arch/arm/src/lpc17xx/lpc17_gpioint.c: Correct errors in logic that maps
and IRQ number into a register bit number.
* Makefile: Fix an error introduced in the top-level Makefile in NuttX-6.1.
This error only shows up if you have a /tftpboot directory. Then the
make will fail with an obscure error about not being able to stat pass2.
* configs/lpcxpresso-lpc1768/nsh: Add an NSH configuration for the
LPCXpresso board.
* configs/*/ld.script: Removed 'sh_link not set for section .ARM.edix' for
a few of the builds. In you have this warning, it can be removed with the
following change to the ld.script file:

+ __exidx_start = ABSOLUTE(.);
.ARM.exidx : {
- __exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
- __exidx_end = ABSOLUTE(.);
} >sram
+ __exidx_end = ABSOLUTE(.);

* arch/arm/src/lpc17xx: Correct some typos/bugs in configuration of LPC17xx UART2 and UART3.
* nuttx/clock.h: Replace all references to the global variable g_system_timer
with clock_systemtimer() (currently just a macro that that returns g_system_timer).
* lib/string/strrch.c: Would fail if the searched-for character were the first
character in the string.
* tools/version.sh and mkversion.c: Tools to manage a NuttX version number
file
* sched/clock_getutc() and lib/time/lib_time.c: Add support for 1 second UTC
interface.
* net/net_dup2.c and include/nuttx/net.h: The conditional compilation for
#if CONFIG_NFILE_DESCRIPTOR > 0 was wrong in both of these files. It should
be'#if CONFIG_NFILE_DESCRIPTORS > 0. This causes a dup2() failure in THTTPD
and a failure to get a CGI page. The consequence can be a very serious bug!
* configs/lpcxpresso-lpc1768/usbstorage, thttpd, and dhcpd: Add an USB storage,
THTTPD web server, and DHCP server configurations for the NXP LPCXpresso board.
* drivers/lcd/ug-9664hswag01.c and ssd1305.h: Add support for Univision UG-9664HSWAG01
OLED with Solomon Systech SD1305 LCD controller.
* configs/lpcxpresso-lpc1668/nx: Add a NX graphics configuration for the LPCXPRESO
board.
* graphics/nxglib/nxglib_nonintersecting.c: Fix some single bit errors in
calculation of non-intersecting regions. This was causing an anomaly
in examples/nx in column 0.
* drivers/mtd/rammtd.c: Added a RAM based MTD driver. This RAM driver simulates
FLASH and is useful for testing purposes.
* arch/arm/src/arm/up_head.S: Fix backward conditional compilation. This cause
the configs/mx1ads configuration to fail to build but does not appear to affect
any other ARM9 build.
* fs/nxffs: Adding a tiny, wear-leveling FLASH file system for NuttX. This
file system is intended to be small and will have some limitations. The
implementation is incomplete on initial checkin.
* apps/examples/nxffs and configs/sim/nxffs: Add a test a a configuration that
will be used to verify NXFFS.
* fs/fat/fs_fat32.c and fs_fat32util.c: Incorpated two bugs with fixed provided
by Sheref Younan. Thanks!
* fs/nxffs: After a couple of weeks of testing and bug fixes, NXFSS appears
stable and functional.

__._,_.___
Recent Activity:
.

__,_._,___

Gmane