Forum Discussion

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

alt_write_flash - single threaded

I'm currently experimenting with uC/OS-II with NicheStack on Nios II. Things are going well except for situations where I am writing 128K of data to flash using alt_write_flash(). I noticed in the Nios II Software Developers guide that alt_write_flash() should be used in a single threaded build. Is there a HAL implementation that allows flash writing in multithreaded mode available in the NIOS II EDS or must I implement this myself?

11 Replies

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

    --- Quote Start ---

    Hello,

    thanks a lot for your ideas...

    I have solved the problem!

    It was my fault...

    The problem was a Stack Overflow within the Task wich writes to the flash memory. This overflow accours only, if the flash-write will be executed and if a interrupt context places it's data on the stack of this tasks either. In this case the stack usage increases from about 36% to overflow on a 22 kByte Stack!!

    It is possible to use the flush-driver on a multythreaded enviroment as long as only one task is accessing the flash-device. I think that this is what Altera means with the parameter "thread safe: no"

    --- Quote End ---

    Great news! I'm glad you sorted it out. Cheers.