Low Level programing using c++

The Due is using the CMSIS abstraction layer, this defines a heap of structures with elements that match the underlying hardware, so you can reference registers directly like this

NVIC->ISER = x;

to write x into the Nested Vector Interrupt Controller's ISER register. Same applies for the UARTs, timers and everything else. NVIC in this case is the address of the controller and ISER and element in the structure at the same offset as the ISER reg in the hardware.

Another example

LPC_UART0->THR = *BufferPtr;

This writes a character from a buffer into the Transmit Holding Reg of UART0. (NOTE: this is for an LPC, the names will change for SAM but the basic idea is the same).

So all the places we used to do

DDRB |= _BV(3);

Will now be something like

PIOB->PIO_SODR |= (1 << 3); // _BV may still work if the macro has been ported

But don't quote me on the names used, I'm not very familiar with the SAM register names yet.

I assume Thumb2 is the name of the processor's machine language (or assembly language) instruction set

Correct.

As for genuine assembly language, given the above and the great optimisation of modern compilers it's hard to imagine when it would be required, but the GCC compiler allows it in the same way we currently do inline assembler with the AVRs. eg

asm ("valid asm code here");

An alternative is to have a separate assembly file with just ASM code in that and link it into the project.


Rob