1

I am working with an STM32F4 Microcontroller, and I am unable to use inline assembly that I am trying to port from another ARM processor. I have no idea where to begin trying to figure out the problem

2 Answers 2

2

There is an easy way.. You can use the asm key word.

asm("NOP"); for example will wait for one clock cycle and carry on. You can expand the results.

1
  • 3
    FYI: ARM explicitly state that NOP is for padding, not timing. It might take a cycle, but your vendor's implementation is free to prune it from the pipeline before it gets executed. I've seen the STM32F4 perform optimisations like this.
    – Andy Brown
    Oct 29, 2014 at 8:53
1

Well, I would normally say that you should post your code, but in this particular case, I would advise you to always do a little homework on processor architecture when working with microcontrollers.

The STM32F4 (Cortex M4 Processor architecture) does not use the typical arm and thumb instruction sets, like the ARM7 or many other ARM processors. Cortex M4 processors run in Thumb2 mode, which includes subsets of both the ARM and THUMB instruction sets, requiring no arm->thumb or thumb->arm switches (or instructions).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.