Re: Embedded software interview question collection



"Michael N. Moran" wrote:
Julian Gardner wrote:

Well ive been arguing with a company because they cant get to
grips what volatile really does and because of this the new piece
of hardware they have released witb an embedded processor does
not work if the cache is switched on!!!!

I have tried for 2 years to get them to understand but they still
screw the design up.

I now need to got through all my code and try to move every
variable into a seperate block of memory so there will be no
memory corruption.

Off topic, but ... maybe it's because my brain hasn't clicked on
yet, but what has the use of volatile got to do with cache?

Say the variable is really a hardware status bit, memory mapped.
If declared volatile in the code there will be a memory access for
each read. If the hardware diverts that read to the cached value,
it will no longer reflect reality. So the system needs some means
of automatically invalidating the cache. To me, this is a primary
objection to using memory mapped i/o ports, which can easily be
avoided with a separate i/o space.

I don't know if this is the OPs problem, but it seems likely.

--
"I was born lazy. I am no lazier now than I was forty years
ago, but that is because I reached the limit forty years ago.
You can't go beyond possibility." -- Mark Twain



--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: double-checked locking in C
    ... Of course you may think that the object takes place on cache line boundary and is only partially updated. ... Then if I stick to standards, the C norm is enough and I just have to use volatile. ... # 4.10 Memory Synchronization ...
    (comp.programming.threads)
  • Re: Doug Harrison, please!
    ... from two different CPUs without an intervening memory barrier. ... The volatile idiom works on IA-32 machines because these systems implement ... strong cache coherency between processors in an SMP machine. ... drivers which interface with memory-mapped hardware. ...
    (microsoft.public.vc.language)
  • Re: Embedded software interview question collection
    ... volatile really does and because of this the new piece of hardware they have released witb an embedded processor does not work if the cache is switched on!!!! ... I now need to got through all my code and try to move every variable into a seperate block of memory so there will be no memory corruption. ... and this could be catagorized as DMA. ...
    (comp.arch.embedded)
  • Re: What is the meaning of this warning, and how do I get rid of it?
    ... applications such as device drivers and memory-mapped I/O. ... %% A static volatile object is an appropriate model for a memory ... %% take into account relevant hardware details on the target systems ... Some machines reserve memory addresses such that reads from or writes ...
    (comp.lang.c)
  • Re: [PATCH 1/24] make atomic_read() behave consistently on alpha
    ... CPU can hold that data in cache as long as it wants before it writes ... it to memory. ... not-yet-written volatile value. ... Communicating both with interrupt handler and with other CPUs. ...
    (Linux-Kernel)