[En-Nut-Discussion] NutNvMemSave overwrites other data

Ulrich Prinz uprinz2 at netscape.net
Tue Aug 2 17:28:19 CEST 2011


Hi!

Sorry, I never got back my EN3.1 which I borrowed someone. So I can 
only guess by what I learned/did for the CortexM3 port.

Lets get it in a row:
1. You need to define some physical memory or use some existing memory:
To add one, include an eeprom driver from "Device Drivers".
To use an existing memory, like the embedded or externally connected 
FLASH that is initialized by the board file, skip that step above.

2. Declare the memory start and size
Go to "Device Drivers/Non Volatile Memory"
Select the appropriate memory type. For my cortex I use STM32-On-Chip 
Flash, you might want AT91 On-Chip Flash.
Enter the Flash Sector Address for your config data. It must be on 
sector boundary for AT91, For STM it can be anywhere as the driver is a 
bit more intelligent.
May be you want to limit, the size, I cannot promise that size checks 
are working on any device properly.

3. Declare the config sections in the above defined sector(s)
For the OS go to "RTOS Kernel / Configuration"
The value "Location" is the offset inside the above defined Sector.
So in my STM32 I use the last sector of the flash and its start address 
is 0x6000.
My Location value is 0 so the Configuration is stored in 0x6000.

The network config is configured in "Network (general) / Network 
Configuration"
Here, the location is again a relative offset to the sector prepared in 
1) and 2).
My network config is stored at Location 0x100
As a result it will be physically saved in 0x6100.

Ah, I forgot about ARM specialties :)
Some of them can switch a bank to several address ranges. Some of them 
simply mirror it, sometimes.

So if you start with bootloader the FLASH might be at 0x00000000 and 
the bootloader is at 0x04000000. Then the application init starts and 
switches vectors to 0x08000000. Now it depends on how strange the last 
weekend of the chip designer was...
Sometimes you can now access flash from 0x00000000 and 0x08000000, some 
chips ignore the access other give you a memfault exception.
But no fear, behavior is always the same with one series of chips. If 
you figured it out with AT91SAMxyz it works on all of these.

Hope this helps.

Best Regards
Ulrich


-----Original Message-----
From: Stefan Profanter <enut at s.profanter.me>
To: 'Ethernut User Chat (English)' <en-nut-discussion at egnite.de>
Sent: Tue, Aug 2, 2011 3:30 pm
Subject: Re: [En-Nut-Discussion] NutNvMemSave overwrites other data


Sorry, i forgot to mention:I'm using Ethernut 
3.1DGreetingsStefan_______________________________________________http://
lists.egnite.de/mailman/listinfo/en-nut-discussion
  



More information about the En-Nut-Discussion mailing list