Forum: ARM programming with GCC/GNU tools "Semaphore" with thumb code

von Toni R. (tau)

Rate this post
0 useful
not useful

I have a following situation with Yagarto and AT91SAM7X:

Interrupt routine counts interrupts;


In main loop, I need to do further processing based
on received signals (I want to keep interrupts lightweight,
so only minimal amount of work should be done there)

somevalue = signals*somescaler;
signals = 0;

Now, this is very thread-unsafe. But how can I do this safely with thumb
instruction set? No swp in thumb set, and load/store combination isn't
very atomic, and  the disabling interrupts apparently is troublesome

I understood that disabling interrupts with AIC_IECR->IDCR causes
spurious interrupts, but could that really cause extra interrupts (ISR
called twice if it triggers at bad moment) or does that interrupt just
get served late? ISR getting server late would be no problem, since I
can do necessary processing fast enough to not miss interrupts, but how
is the situation exactly?

Now, another thing that isn't clear to me is thumb-interwork -mode. In
which situations that is needed exactly? For practical example, if I
have for example thumb module calling ARM (to access that precious swp
for example), how should I do that?
Non-interwork thumb-module calls interwork-thumb module that calls ARM
module, or how? (that single swp or access to global interrupt flag gets
really expensive really fast this way...)


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.