[En-Nut-Discussion] Anything to look for NutO/S on AT90CAN without ext RAM?

Ulrich Prinz uprinz2 at netscape.net
Fri Aug 14 01:22:53 CEST 2009


Thank you Uwe, it seems to work fine!

Best regards, Ulrich

Uwe Bonnes wrote:
>>>>>> "Ulrich" == Ulrich Prinz <uprinz2 at netscape.net> writes:
> 
>     Ulrich> Hi!  I'd like to start an other project based on NutO/S and an
>     Ulrich> AT90CAN128. I have no RAM but I do not need network. Just want
>     Ulrich> to use the framework, tasks and device drivers.
> 
>     Ulrich> What to modify in NutO/S that it does not try to enable external
>     Ulrich> RAM and put data there?
> 
> Here is the config I have for a AT90CAN128 configuration without RAM:
> 
> PLATFORM = "ETHERNUT2"
> AVR_GCC = ""
> GCC_DEBUG = ""
> MCU_AT90CAN128 = ""
> NUTMEM_START = "0x100"
> NUTMEM_RESERVED = "64"
> NUT_CPU_FREQ = "16000000"
> ATCAN_RX_BUF_SIZE = "4"
> 
> Be sure to lower the number of can buffers, as these buffer chew lots of memory.
> I also lowered  UART queues, as one UART is only uses to send out data and
> the other only does one-wire communication
> 
>       result = NutRegisterDevice(&DEV_UART1, 0, 0);
>       uart1 = fopen(DEV_UART1_NAME, "r+");
>       _ioctl(_fileno(uart1), UART_SETSPEED, &baud);
>       /* 090209: we don't evaluate received chars, so reduce queue size */
>       _ioctl(_fileno(uart1), UART_SETRXBUFSIZ, &buf_size);
>       
> The firmware runs on several devices, doing some detection magic. In the
> case these boards have external ram, I enable it:
> 
>   /* Use external RAM (but not for STACK!) */
>   XMCRA = _BV(SRE) | _BV(SRW10); /* Upper range from 0to ffff, 1 Waitstate*/
>   XMCRB = _BV(XMBK); /* Keepers, Full memory range*/
>  
> I can place variables there like
> volatile unsigned char ll_relais[2]     __attribute__ ((section (".aram")));
> volatile unsigned char nco_state        __attribute__ ((section (".aram")));
> volatile unsigned long int nco_r[4]     __attribute__ ((section (".aram")));
>          unsigned char nco_hid[8]       __attribute__ ((section (".aram")));
>          unsigned char hf_hid[8]        __attribute__ ((section (".aram")));
> 
> I added in the application Makefile
> 
> include $(top_srcdir)/nutapps/Makerules
> 
> LDFLAGS += -Wl,--section-start=.aram=0x801100  -Wl,--section-start=.fpga=0x80e000
> BINFLAGS += -R .aram -R .fpga
> 
> cps.o: ../inc/cps_can.h ../inc/fpgaboards.h
> 
> That way, no pointer in the base ram is needed for these variables
> 
> If there are memory mapped registers I do
> 
> volatile unsigned char * alu_ctl= (unsigned char *)             0xe000;
> volatile unsigned long int *prog_data  = (unsigned long int *)  0xf000;
> volatile unsigned long int *const_data = (unsigned long int *)  0xf400;
> 
> 
> Hope this helps



More information about the En-Nut-Discussion mailing list