Author Topic: Cortex M0 Design Start - using Flash memory instead of PSRAM  (Read 2522 times)

0 Members and 1 Guest are viewing this topic.

Offline skorpyon1992Topic starter

  • Newbie
  • Posts: 6
Cortex M0 Design Start - using Flash memory instead of PSRAM
« on: August 03, 2014, 10:45:32 am »
 Hello everyone ,
 
   I have a few problems using ARM Cortex M0 Design Start and some peripherals from CM0DS-DesignKit. I have made a climate control system using Nexys 3 FPGA board with the core and peripherals mentioned earlier.
   I have a .bin file ( the C & assembly code)  which I have to write it to the nexys 3  RAM memory using Adept, and a .bit file ( the ISE project ) which will be programmed on the board. If I have a power lack, the memory RAM ( obviously ) it will be empty at the next start , and I would have to reprogram it again.
   The ARM microcontroller architecture has a Memory Controller which can control the RAM memory and FLASH memory ( BPI Flash ) . The addresses for them are mapped as in SoC example 4 from CM0DS EDK ( http://www.arm.com/support/university/ip/index.php ).
   I would like to have a single file from these two, or load the .bin file to RAM from flash. Can this be possible and how?
 

Offline 6thimage

  • Regular Contributor
  • *
  • Posts: 181
  • Country: gb
Re: Cortex M0 Design Start - using Flash memory instead of PSRAM
« Reply #1 on: August 04, 2014, 12:09:23 pm »
From my understanding, you have a design which has the program run from RAM instead of flash and you want to be able to power cycle the board without it being connected to a computer.

Unfortunately, you won't be able to combine the bit file and the contents of the RAM into a single file. However you could write a simple loader module that runs prior to the Cortex M0, which copies the contents of the flash to the RAM.

But I think you might have overlooked a simpler solution. The AHB2SRAMFLSH module allows you to select whether the RAM or flash is mapped to zero. If you were to change your design to make the flash start at zero then you will not need to copy the program onto the board with every power cycle. This change, however, is not just as simple as changing this module's input, as you will need to adjust the position of the RAM in your program's code.
 

Offline skorpyon1992Topic starter

  • Newbie
  • Posts: 6
Re: Cortex M0 Design Start - using Flash memory instead of PSRAM
« Reply #2 on: August 06, 2014, 12:07:02 pm »
Thank you 6thimage for the advice.  I have solved the problem.

 The following steps were followed :
 
  1. In the Keil ARM prject go to Target Options  ( Target tab ), check ROM1 , set address to 0x0 and size 0x800000 and choose it as startup;
  2. In the Linker tab add the following addresses 0x00000000 (at R/O base ) and 0x00800000 ( at R/W base );
  3. Rebuild the project;
  4. Write the file to the memory ( Memory tab - > choose BPI -> at Write File to Memory browse and choose the binary file -> choose start address to be 0 in Hex and Write ) ;
  5. Choose the SPI and "Write programming file to Flash"  ( browse for -the .bit file from the Xilinx Project and Write it ) and reset the board ( or you can simply go back to the config tab and browse for the .bit file and program it);
   
   I hope this will be helpfull for other people too!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf