Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

Changing the RAM adr for my program

Hi

I want to know how I can change the address where the program will be copied into the RAM. Right now everytime I build the app the srec2flash utility reports that the app spans from 0x1000000 to 0x1007628. How can I change this so the app is put somewhere else in the RAM???

Regards

GreateWhite.DK

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello,

    There are hooks in the srec2flash utility that should allow you to do this. Here's an output that I get by running 'srec2flash' with no arguments:

    $ srec2flash
    flash address: 0x00140000
      ram address: 0x00000000
    max copy size: 0x00000000
            srec2flash <filename>.srec 
        --flash_address=x     Where in flash to store the copier & program,
                              (defaults to 0x140000)
        --ram_address=x       Where in RAM to copy the program to, and execute
                              (defaults to 0x40000)
        --copy_size=x         How many bytes to copy from flash to RAM
                              (defaults to 0x40000)
        --sdk_directory=<dir> Specify an sdk directory
    "srec2flash"
    The Nios development board&#39;s Germs monitor looks
    for code in flash memory. The srec2flash utility
    takes code targeted for program memory and
    prepends a copying routine to copy itself from
    flash memory to program memory. It also prepends
    the necessary Germs monitor commands to write
    the file into flash.
    The output, <filename>.flash, can be burnt to
    flash by using nios-run:
            nios-run -x <filename>.flash
    (Only works over serial; nios-run over jtag
    does not support this feature.)

    In other words, this command does return the default values, when run with no arguments, but by using the --ram-address=<your_new_location> option, you should see the behavior that you want.

    Hope this helps.

    Cheers,

    - Brendan
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If its a simple program just use -b build option to set the base address? I use it all the time to relocate srec files:

    nb -b 0x1000600 my_prog.c

    This gives germs that starts at 0x1000000 enough room so that I can load and reload new builds over the serial port without rebooting my board.

    Ken