version 4.0.5: is it stable?

nobody wrote on Tuesday, August 22, 2006:

I have changed all files on the kernel v3.2.4 to v4.0.5. But then system is crashing. When I used old list.c system goes but crashing too. When I used old list.h (v3.2.4) system goes without problems.

Has anybody experienced that?

nobody wrote on Wednesday, August 23, 2006:

I have been using V4.x.x for some time with no problem.  There were some changed in list.c between 3.x and 4.x that reduced the RAM usage.

The live WEB servers have also been running for a long time using V4 so I think it is stable.

Can you debug and find exactly where the crash is occurring?  We should then be able to help find the problem.

Stack usage as always is the first place to look.

Which port are you using?

nobody wrote on Wednesday, August 23, 2006:

I am using AT91SAM7 lwIP Rowley port using GCC only (SAM7_GCC)…

Janusz

nobody wrote on Wednesday, August 23, 2006:

There are compiling parameters:

Compiling C: Source/list.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2 -DROM_RUN -DVECTORS_IN_RAM -DSAM7_GCC -DTHUMB_INTERWORK  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=Source/list.lst  -I./Source/include -I./lwip-1.1.0/src/include -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I./lwip-1.1.0/src/include/ipv4 -I./lwip-1.1.0/src/netif/ppp -I. -I./lwip-1.1.0/src/include -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I./Source/include -I./Source/portable/GCC/ARM7_AT91SAM7S -I./lwip-1.1.0/src/include/ipv4 -I./lwip-1.1.0/src/netif/ppp -I./EMAC  -MD -MP -MF .dep/list.o.d -Wnested-externs -std=gnu99 Source/list.c -o Source/list.o

All other files of version 4.0.5 and port files weren’t modified but system is crashing with new list.c/h. My LED controls indicate there is problem during first context switching…

nobody wrote on Wednesday, August 23, 2006:

Have you tried the lwIP/Rowley demo that is included in the download?  Without your application code, to make sure this works for you.

There was also an update to the EMAC driver in one of the newer FreeRTOS versions.  Check the history file.

nobody wrote on Wednesday, August 23, 2006:

Where is my mistake?
When files list.* are from 3.2.4 there is only warning about end line…
With 4.0.5 it is a reason:
In file included from ./Source/include/FreeRTOS.h:46,
                 from Source/list.c:82:
./FreeRTOSConfig.h:78:31: warning: no newline at end of file
Source/list.c: In function ‘vListInitialise’:
Source/list.c:94: warning: dereferencing type-punned pointer will break strict-aliasing rules
Source/list.c:102: warning: dereferencing type-punned pointer will break strict-aliasing rules
Source/list.c:103: warning: dereferencing type-punned pointer will break strict-aliasing rules
Source/list.c: In function ‘vListInsert’:
Source/list.c:160: warning: dereferencing type-punned pointer will break strict-aliasing rules

why?

nobody wrote on Wednesday, August 23, 2006:

This is my command line.

arm-elf-gcc
    -c
    -mthumb
    -I.
    -I./EMAC
    -I…/Common/include
    -I./USB
    -I./lwip-1.1.0/src/include
    -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X
    -I…/…/Source/include
    -I…/…/Source/portable/GCC/ARM7_AT91SAM7S
    -I./lwip-1.1.0/src/include/ipv4
    -Wall -Wextra
    -Wstrict-prototypes
    -Wmissing-prototypes
    -Wmissing-declarations
    -Wno-strict-aliasing
    -D SAM7_GCC
    -D THUMB_INTERWORK
    -mthumb-interwork
    -mcpu=arm7tdmi
    -Tatmel-rom.ld
    -g
    -O0

Could it be something to do with VECTORS_IN_RAM?

Try reducing the optimisation, even if that does not fix the problem it might make it easier to debug.  Can you find the instruction that causes the crash?

Did you change GCC versions also?

Notes from the history file that might be relevant:

    + The heap size defined for the lwIP Rowley demo has been reduced so that
      the project will link correctly when using the command line GCC tools
      also.  The makefile has also been modified to allow debugging.

[are you sure the scheduler is even starting?  Maybe it runs out of RAM]

    + Modified the GCC ARM7 port layer to allow use with GCC V4.0.0 and above.
     

nobody wrote on Wednesday, August 23, 2006:

my compiler gcc is from WinARM version 20060606…

nobody wrote on Wednesday, August 23, 2006:

scheduler: it is works properly
lwIP demo: I cannot to link that due to errors like
c:/winarm/bin/…/lib/gcc/arm-elf/4.1.1/…/…/…/…/arm-elf/lib/interwork\libg.a(
freer.o): In function `_malloc_trim_r’:
mallocr.c:(.text+0x48): undefined reference to `_sbrk_r’
mallocr.c:(.text+0x64): undefined reference to `_sbrk_r’
mallocr.c:(.text+0x84): undefined reference to `_sbrk_r’

nobody wrote on Wednesday, August 23, 2006:

i am not using EMAC - this is AT91SAM7S version of uC, not 7X…

nobody wrote on Wednesday, August 23, 2006:

The error on line 94 comes from the case from an xMiniListItem to an xListItem.  This cast is deliberate.  A mini list item is used to reduce RAM usage.

Use -Wno-strict-aliasing to get rid of the warning.

nobody wrote on Wednesday, August 23, 2006:

There have been several messages on this forum before where people have not managed to get WinARM to work.  The files are tested with GNUARM (http://www.gnuarm.org).  I don’t know what the differences are.

nobody wrote on Wednesday, August 23, 2006:

I thought you said you were using lwIP hence I assumed it was an X…I must be getting confused with a different thread.

nobody wrote on Wednesday, August 23, 2006:

but now I am testing only FreeRTOS without lwIP initialization. BTW lwIP does not crash.

nobody wrote on Wednesday, August 23, 2006:

now I have list from 4.0.5, list does not generates warnings this time:

Compiling C: Source/list.c
arm-elf-gcc -c -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2 -DROM_RUN -DVECTORS_IN_RAM -DSAM7_GCC -DTHUMB_INTERWORK  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wno-strict-aliasing -Wa,-adhlns=Source/list.lst  -I./Source/include -I./lwip-1.1.0/src/include -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I./lwip-1.1.0/src/include/ipv4 -I./lwip-1.1.0/src/netif/ppp -I. -I./lwip-1.1.0/src/include -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I./Source/include -I./Source/portable/GCC/ARM7_AT91SAM7S -I./lwip-1.1.0/src/include/ipv4 -I./lwip-1.1.0/src/netif/ppp -I./EMAC  -MD -MP -MF .dep/list.o.d -Wnested-externs -std=gnu99 Source/list.c -o Source/list.o

Linking: main.elf
arm-elf-gcc -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2 -DROM_RUN -DVECTORS_IN_RAM -DSAM7_GCC -DTHUMB_INTERWORK  -Os -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wno-strict-aliasing -Wa,-adhlns=startup_SAM7S.lst  -I./Source/include -I./lwip-1.1.0/src/include -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I./lwip-1.1.0/src/include/ipv4 -I./lwip-1.1.0/src/netif/ppp -I. -I./lwip-1.1.0/src/include -I./lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X -I./Source/include -I./Source/portable/GCC/ARM7_AT91SAM7S -I./lwip-1.1.0/src/include/ipv4 -I./lwip-1.1.0/src/netif/ppp -I./EMAC  -MD -MP -MF .dep/main.elf.d startup_SAM7S.o  comm.o cdc_enumerate.o modem.o Source/portable/GCC/ARM7_AT91SAM7S/portISR.o  main.o syscalls.o menu.o strings.o dongle.o Source/portable/MemMang/heap_2.o Source/portable/GCC/ARM7_AT91SAM7S/port.o Source/queue.o Source/list.o Source/tasks.o lwip-1.1.0/src/core/tcp_out.o lwip-1.1.0/src/core/inet.o lwip-1.1.0/src/core/mem.o lwip-1.1.0/src/core/memp.o lwip-1.1.0/src/core/netif.o lwip-1.1.0/src/core/pbuf.o lwip-1.1.0/src/core/raw.o lwip-1.1.0/src/core/stats.o lwip-1.1.0/src/core/sys.o lwip-1.1.0/src/core/tcp.o lwip-1.1.0/src/core/tcp_in.o lwip-1.1.0/src/core/ipv4/ip.o lwip-1.1.0/src/core/ipv4/ip_addr.o lwip-1.1.0/src/core/ipv4/icmp.o lwip-1.1.0/src/api/tcpip.o lwip-1.1.0/src/api/api_msg.o lwip-1.1.0/src/api/err.o lwip-1.1.0/src/api/api_lib.o lwip-1.1.0/src/netif/etharp.o lwip-1.1.0/contrib/port/FreeRTOS/AT91SAM7X/sys_arch.o lwip-1.1.0/src/core/udp.o lwip-1.1.0/src/core/ipv4/ip_frag.o lwip-1.1.0/src/netif/ppp/auth.o  lwip-1.1.0/src/netif/ppp/chap.o lwip-1.1.0/src/netif/ppp/chap.o lwip-1.1.0/src/netif/ppp/chpms.o lwip-1.1.0/src/netif/ppp/fsm.o lwip-1.1.0/src/netif/ppp/ipcp.o lwip-1.1.0/src/netif/ppp/lcp.o lwip-1.1.0/src/netif/ppp/magic.o lwip-1.1.0/src/netif/ppp/md5.o lwip-1.1.0/src/netif/ppp/pap.o lwip-1.1.0/src/netif/ppp/ppp.o lwip-1.1.0/src/netif/ppp/randm.o lwip-1.1.0/src/netif/ppp/vj.o      --output main.elf -nostartfiles -Wl,-Map=main.map,–cref -lc  -lm -lc -lgcc     -TAT91SAM7S64-ROM.ld

Creating load file for Flash: main.bin
arm-elf-objcopy -O binary main.elf main.bin

Creating Extended Listing: main.lss
arm-elf-objdump -h -S -C main.elf > main.lss

Creating Symbol Table: main.sym
arm-elf-nm -n main.elf > main.sym

Size after:
main.elf  :
section             size      addr
.text              81536   1081344
.rodata             3852   1162880
.data               2576   2097152
.bss               43892   2099728
.comment            2214         0
.debug_aranges      1712         0
.debug_pubnames     8170         0
.debug_info       100848         0
.debug_abbrev      21299         0
.debug_line        21056         0
.debug_frame       11892         0
.debug_str         19740         0
.debug_loc         58069         0
.debug_ranges       1296         0
Total             378152

nobody wrote on Wednesday, August 23, 2006:

very strange: with -O0 list v3.2.4 system is crashing!!! with v4.0.5 makes about 300 ticks and crash too!

nobody wrote on Wednesday, August 23, 2006:

ok, after project clean up from my files and with -Os, list v4.0.5 system works fine :smiley:

thx

PS. I still can’t understand why -O0 causes problems…

nobody wrote on Wednesday, August 23, 2006:

without optimalization (-O0 used), when I create task by

xTaskCreate( vxTask, "COMRx0", /*comSTACK_SIZE*/256, NULL, /*uxPriority + comRX_RELATIVE_PRIORITY*/1, NULL );

and commented delays in the task:
static void vxTask( void *pvParameters )
{
    while (1){       
        AT91C_BASE_PIOA->PIO_CODR = LED4;
        vTaskDelay(( portTickType ) 500/*ms*/);
        AT91C_BASE_PIOA->PIO_SODR = LED4;
        vTaskDelay(( portTickType ) 500/*ms*/);
    }
}

system is not crashing!!!

where is a problem??