Forum Discussion

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

cycloneive boot from sd card

Hello to all!

I'm working with a cycloneive board.

I use the program university avalon sd card interface, and i can read and write a file (fat16) from/to a 2GB sd card.

I would copy a .bin file to sd card, generated with "nios2-elf-objcopy -O binary file.elf output_file.hex" command, and store it in in sdram memory for execute it:

int mem=0;

int* pt_sdram=(SDRAM_0_BASE +0x00100000);

unsigned char midata[4];

for(i=2020;i>0;i--){

mem=0;

midata[0]= alt_up_sd_card_read(sd_fileh);

midata[1]= alt_up_sd_card_read(sd_fileh);

midata[2]= alt_up_sd_card_read(sd_fileh);

midata[3]= alt_up_sd_card_read(sd_fileh);

/*

*/

mem=midata[0];

mem<<=8;

mem|=midata[1];

mem<<=8;

mem|=midata[2];

mem<<=8;

mem|=midata[3];

IOWR(pt_sdram,0,mem);

++pt_sdram;

}

//andrun it with:

asm (

"call (SDRAM_0_BASE +0x00100000);"

);

Is it possible?

TNX, Luca

13 Replies

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

    i have 2 bsp files. bsp for boot and bsf for application.

    i need to do it in both files?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes, but this is not mandatory.

    You could actually define sdram1 region only in boot application and sdram2 region only in real application.

    The other part of the physical sdram address range remains unassigned, so it will not be available for mapping in linker .
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    ok.

    i attach the bsp config for boot and app.

    i attach also the object file app.

    this work only if the boot command calls the app at the address 0x02000048:

    asm (

    "call 0x02000048"

    );

    But the app code is mapped to address 0x02000000.