[En-Nut-Discussion] PLEASE HELP - NEED WORKING THREAD SAMPLE FOR OWN ATMEGA128 PROJECT
Harald Kipp
harald.kipp at egnite.de
Tue Jan 25 18:01:30 CET 2005
Stephan,
I recall, that you're using the Configurator, right?
Make sure to disable "Extended Memory Size" in
"Memory Management". When creating the build tree,
include/cfg/memory.h (in your build tree) should
contain
--- snip ---
#ifndef NUTMEM_SIZE
#define NUTMEM_SIZE 4096
#endif
#ifndef NUTMEM_START
#define NUTMEM_START 0x100
#endif
#ifndef NUTMEM_RESERVED
#define NUTMEM_RESERVED 64
#endif
--- snap ---
but no entry beginning with NUTXMEM...
In the 3.9.2 source tree the file os/arch/avr_nutinit.c
contains (uses cfg/memory.h from build, not from source tree)
--- snip ---
#include <cfg/memory.h>
#ifdef NUTXMEM_SIZE
/*!
* \brief Last memory address using external SRAM.
*/
#define NUTMEM_END (u_short)(NUTXMEM_START + (u_short)NUTXMEM_SIZE - 1U)
#else
/*!
* \brief Last memory address without using external SRAM.
*
* \todo Shall we support NUTRAMEND for backward compatibility? If, then
* let's do it in cfg/memory.h.
*/
#define NUTMEM_END (u_short)(NUTMEM_START + (u_short)NUTMEM_SIZE - 1U)
#endif
--- snap ---
and further down
--- snip ---
if ((u_short)NUTMEM_END - (u_short) (&__heap_start) > 384) {
NutHeapAdd(&__heap_start, (u_short) NUTMEM_END - 256 - (u_short)
(&__heap_start));
}
--- snap ---
which results in something similar, except __heap_start is used
instead of __bss_end. Can't remember right now why this had
changed, but indeed __heap_start should be correct.
Please look into threads.map and tell me, what hex value
is in front of
PROVIDE (__heap_start, .)
and
__bss_end
Here it is 0x02000424 for both values.
Harald
At 12:40 25.01.2005 +0100, you wrote:
>hi
>
>i use a own atmega128 project with fixed freq (16MHz), no 32kHz crystal and no
>external ram and no lan interface
>
>so i only need the nut/os
>
>i use nut392 and the latest winavr...
>
>i have compiled successfully the basemon.c and this example is working, if
>i set
>the baudrate fix to 9600..
>
>then i have tested to make 2 threads (as in example threads.c, the first
>writes
>H, the second writes L to the serial board).i excluded the basemon() function.
>on the serial port i get only the character from the first thread (H) and the
>nutSleep in the threadfunction seems to not working (NutSleep(125) and
>NutSleep(5000) has the same effect - always as fastet it can)...
>
>so my question: maybe i use some wrong software environment ???
>has anyone a thread sample for an atmega128 with no ext ram, fixed freq and no
>32kHz crystal...?
>
>and i need always to include this lines for winavr, because i see that without
>this lines the basemon is not working ??? :
>
>#ifdef __GNUC__
>void NutInit(void) __attribute__ ((naked)) __attribute__
>((section(".init8")));
>extern int NutAppMain(void) __attribute__ ((noreturn));
>#endif
>
>void NutInit(void)
>{
> extern void *__bss_end;
> NutHeapAdd(&__bss_end, (uptr_t) RAMEND - 256 - (uptr_t) (&__bss_end));
>
>
>thx stephan
More information about the En-Nut-Discussion
mailing list