error while flash rom read write for sams70n19

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm coding a bootloader for sams70n19 board and I have memory organization as follows - 

bootloader is at: rom (rx)  : ORIGIN = 0x00400000, LENGTH = 0x00010000

application is at: rom (rx) : ORIGIN = 0x00410000, LENGTH = 0x00040000

1.For my bootloader code -

I have also noticed one thing that even thoughstart address ROM as 0x00400000 in ld file, I can see the whole hex data for firmware is present at location 0x00000000 too. Firmware is present at from address 0x00000000 and 0x00400000. So it copies the whole section again?

It's really confusing. What I'm missing in this case?

2. I'm using flash_write and flash_read functions to write application firmware into the ROM locations (which starts from address 0x00410000). 

In ASF in hal_flash.c, they have one error check -

 

</* Check if the address is valid */

if ((dst_addr > page_size * total_pages) || (dst_addr + length > page_size * total_pages)) {

return ERR_BAD_ADDRESS;>

So dst_address can be max upto 256kb (0x00000000 to 0x0003ffff). If dst_address is bigger than 0x0003fff (in my case application firmware is starting from 0x00410000), it generates invalid address argument error. So I'm not able to access 0x00410000 location.
I have verified that using flash_read and flash_write operations, I can only read write a page from 0x00003200 location (only this single location. Even 0x000042000 doesn't work or immediate page after 0x00003200 doesn't work)
How to tackle this issue? Am I missing some setting some initialization steps?

Help in this is really appreciated