Forum Discussion

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

how to protect factory image data in epcs flash from rewriting or erasing?

Hello.

I'm using NIOS II with remote system update(rsu_cyclone4 from alterawiki) and EPCS flash controller cores on Cyclone IV E(DE2-115).

And there are 2 images in flash(EPCS64):

Factory image(hardware + software) on address 0x0

Application image(hardware + software) on address 0x00200000.

All works great. System is booting with factory image and I can configure it with application image.

But i need to write one more image to EPCS or rewrite first application image.

I'm doing it with NIOS II and EPCS flash controller (using alt_epcs_flash_write_block).

So, the question is how to protect factory image data in epcs flash from rewriting or erasing?

3 Replies

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

    There is no protection function in the EPCS itself so you can't define a protected area. You need to do this in your software, i.e. before it erases or rewrites a block, it should check that it is in the application region and not the factory one.

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

    The EPCS memory chips are standard SPI memory and do have the ability to protect part of the image. However the protected part will be at the top so is useless for protecting the factory image read by AS.

    If you use PS you could arrange to read from a high address and then protect that area.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you for your help.

    I found information about APFC_BOOT_ADDR instruction in Cyclone IV E.

    Seems that the best way is to do this in NIOS software.