Frameworks and Flashc and writing to Flash

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok been trying...

first how i put a variab;le in user flash?

lets say

flash[3]{
1,2,3
}

now with flashc.h i can call to write 1 byte

extern volatile void *flashc_memset8(volatile void *dst, U8 src, size_t nbytes, Bool erase);

i want to write 0xFF to flash[0]

been trying not working

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think all the flash functions are used with the USB bootloader source code, take a look in the framework SERVICES/USB/CLASS/DFU

-sma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok good deal

Main thing I still am having troubles with unlike avr 8 bit is how do i define data in flash at the location I want, and also how to I view my flash. I figured out how to view the ram, but no flash..

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How to view it in AVR32Studio??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes
or anywhere else

like i could with avrstudios 4
i could see the flash

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

also if i am setting a array in flash to be wrote to during runtime (meaning in user flash)
how to I declare it?

volatile unsigned char test[] or
static or ??

thanks for the replies

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

volatile unsigned char test[3] =
{
0x00,0x00,0x00
};

// param dst Pointer to flash destination.
// param src Source half-word.
// param nbytes Number of bytes to set.
// param erase Whether to erase before writing: \c TRUE or \c FALSE.
// return The value of \a dst. */

flashc_memset8(&test[1], 0xFF,1,TRUE);

This compiles with no warnings or errors. But is my array in flash?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

try to use const unsigned char

-sma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did, and get this warning...

Severity and Description Path Resource Location Creation Time Id
warning: passing argument 1 of 'flashc_memset8' discards qualifiers from pointer target type training_lab1 training_lab1.c line 90 1200950986827 28502

set as in the post above, i get no warnings.

I will try both ways tonight.

Still wanna know how to see my flash contents.

Mike

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you try the debug session in AVR32Studio then memory view, check the flash address 0x80000000?

-sma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes and all I got was ?? ?? in the data area, so I am thinking that the view memory is just for sram......

I can see my ram variables there, but not the flash....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you can try the command line
avr32program read -o0x8000000 -s512
to read 512 bytes.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok, will give that a try

I assume that is from a dos shell?

Mike

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes it is and is not flash at 0x80000000 and not 0x8000000?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

0x8000 0000

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok declare it as const in test[3] ={0,0,0}

and than call it... will write flash on runtime.

Problem Solved