Forum Discussion

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

Is there a way to translate the nios C files to hex files?

Hi,

My project is connecting between PC app to altera device.

I want to add option in my app to update the altera's software.

for that I need to write the altera's software into a flash device using usb uart, so I need to write the data to the flash cells in hex.

I'm thinking to convert the C code to HEX code and just write it to the flash,and tell the CPU jump to the flash memory address and read the software from there.

I also need to know how to get the cpu "on-chip memory" instruct the CPU to read the C program from the flash address that I written the file on.

My goal is to program my system without using the Jtag.

thanks alot!

asaf

2 Replies

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

    elf2flash converts your compiled code into a flash compatible image. That said you can't perform write accesses to flash directly since there is a little bit of protocol involved. So if you tried to execute code directly from flash the writes performed to access r/w data, heap, and stack space will fail. The way the bootloader in flash works is it's a small code fragment that gets placed before your code starts, it copies the code from flash to main memory without performing any write accesses to the flash itself.

    http://en.wikipedia.org/wiki/flash_memory has some more information about flash. Basically before you can write to flash you have to open the sector, erase it (usually), and then you can write to the sector. It's not like typical main memory where you can write directly to it unless you have an intelligent controller sitting in front of it to handle that overhead for you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    OK,

    So I'll use RAM ...but it doesn't answer my question.

    I need to know how to get my cpu read its commands from the address I tells him to.

    I know I can do it in the sopc...but I want to command the cpu to read its data on diffrent address and use the on-chip memory to do that...

    https://www.alteraforum.com/forum/attachment.php?attachmentid=2805

    the cpu takes its commands\instructions from the flash, after the on chip-memory(that the CPU's first address pointing is there) tells him to.

    I hope you understood now....

    10x for the help.