[En-Nut-Discussion] config flashspace usage on SAM7X256

Bernd Walter enut at cicely.de
Sat Jun 20 14:26:53 CEST 2009

On Sat, Jun 20, 2009 at 01:35:50PM +0200, Harald Kipp wrote:
> Bernd Walter wrote:
> > I don't need Ethernut to save anything, because I do it myself in an
> > AT45DB chip.
> > But I'm unable to find the code using it so that I can disable.
> > Or is it just reserved for future use?
> Hi Bernd,
> at least saving the configuration had been removed from the system
> libraries in 4.9. Still, the system libraries read CONFOS and CONFNET.
> In general this is done by calling NutNvMemLoad(), provided in
> dev/nvmem.c. Depending on the configuration in include/cfg/eeprom.h,
> this routine may access the X12x6 EEPROM, an AT45DB or AT49BV flash
> memory, the internal EEPROM on AVR CPUs or the internal flash on AT91
> devices.

Ah - must have been blind.
I don't define NUT_CONFIG_AT91EFC and DHCP is working for me.
And At91EfcSectorRead isn't defined in the linked file.
DHCP of course isn't remembering it's former config, but this is ok
for me.
Guess I'm save to asume that nothing is changing Flash pages.

My network startup code is:
        NutRegisterDevice(&DEV_ETHER, 0, 0);
        if (getenv("ip") != NULL && getenv("netmask") != NULL && strcmp(getenv("ip"), "dhcp") != 0) {
                l_ip = inet_addr(getenv("ip"));
                l_mask = inet_addr(getenv("netmask"));
                NutNetIfConfig("eth0", my_mac, l_ip, l_mask);
                if (getenv("gateway") != NULL) {
                        l_gw = inet_addr(getenv("gateway"));
                        NutIpRouteAdd(0, 0, l_gw, &DEV_ETHER);
        } else {
                while (NutDhcpIfConfig("eth0", my_mac, 60000) != 0);
        if (getenv("dns") != NULL) {
                l_dns = inet_addr(getenv("dns"));
                NutDnsConfig(0, 0, l_dns);

getenv is using AT45DB and is derived from AVR code, which was on this
list some time ago.
I'm quite happy with the code as is together with my own AT45DB code.
It was tricky enough, because I'm also running Micro-SD cards with
Nut/OS code on the same SPI.
my_mac is also filled via getenv at a different place, which is doing
the hex parsing.

> If no valid configuration for NVMEM is available, NutLoadConfig will
> return an error, but still set an default hostname. NutNetLoadConfig
> will also return with error, but still set the MAC address to all bits
> set and all other items cleared to zero.
> The problem is, that the returned error will let higher level routines
> fail (e.g. DHCP).

No problems with DHCP so far and it seems that I really don't have any
kind of NV configured.

> In your special case I'd suggest to configure NUT_CONFIG_AT45D (new SPI
> bus interface) or NUT_CONFIG_AT45DB (old with integrated SPI routines.
> For the latter you may then even implement your own At45dbParamRead() to
> override default linking to dev/at45db.c.
> Harald

B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.

More information about the En-Nut-Discussion mailing list