This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

AT91SAM7_64 flash problem

I had a look to the Keil\ARM\Flash\AT91SAM7_64 and it looks this code was design to never run.

1. The example finishes with error
2. ProgramPage should be at least in RAM
3. *Flash++ = *((unsigned long *)buf); -> buf should be aligned before get Data abort exception.

Did someone has some working example with Keil AT91SAM7xx and data flash?

Parents
  • I believe that you have probably missed something. I have just tried it out on AT91SAM7256 (256kB Flash) and it works as expected.

    A simple demonstration of using ULINK's Flash algorithms in an application:

    1. Create a new project and select AT91SAM7S64 (automatically copies the startup code)
    2. Add the FlashPrg.c from ARM\Flash\AT91SAM7_64 folder (comment out the include for FlashOs.h)
    3. Add the following main.c:

    extern int Init (unsigned long adr, unsigned long clk, unsigned long fnc);
    extern int ProgramPage (unsigned long adr, unsigned long sz, unsigned char *buf);
    
    unsigned char __align(4) buf[128];          // Buffer properly aligned
    
    int main (void) {
      int i;
    
      for (i = 0; i < 128; i++) buf[i] = i;     // Init Buffer
    
      i = Init (0x00100000, 18432000, 0);       // Init Flash
      i = ProgramPage(0x00108000, 128, buf);    // Program one Page
    
      while (1);
    }
    


    4. Change Memory assignment for FlashPrg.c (right mouse click) to IRAM1 so that algorithms are copied to and executed from RAM.
    5. Build the application and Flash it
    6. Debug the application which runs correctly and programs one page at address 0x00108000 (can be verified in the debugger)

    An alternative is also to make the whole project for RAM which is then loaded and executed by the debugger.

Reply
  • I believe that you have probably missed something. I have just tried it out on AT91SAM7256 (256kB Flash) and it works as expected.

    A simple demonstration of using ULINK's Flash algorithms in an application:

    1. Create a new project and select AT91SAM7S64 (automatically copies the startup code)
    2. Add the FlashPrg.c from ARM\Flash\AT91SAM7_64 folder (comment out the include for FlashOs.h)
    3. Add the following main.c:

    extern int Init (unsigned long adr, unsigned long clk, unsigned long fnc);
    extern int ProgramPage (unsigned long adr, unsigned long sz, unsigned char *buf);
    
    unsigned char __align(4) buf[128];          // Buffer properly aligned
    
    int main (void) {
      int i;
    
      for (i = 0; i < 128; i++) buf[i] = i;     // Init Buffer
    
      i = Init (0x00100000, 18432000, 0);       // Init Flash
      i = ProgramPage(0x00108000, 128, buf);    // Program one Page
    
      while (1);
    }
    


    4. Change Memory assignment for FlashPrg.c (right mouse click) to IRAM1 so that algorithms are copied to and executed from RAM.
    5. Build the application and Flash it
    6. Debug the application which runs correctly and programs one page at address 0x00108000 (can be verified in the debugger)

    An alternative is also to make the whole project for RAM which is then loaded and executed by the debugger.

Children