[Oberon] Real-time multitasking using interrupt handlers
chris at cfbsoftware.com
Tue Oct 7 12:59:48 CEST 2014
> -----Original Message-----
> From: eas lab [mailto:lab.eas at gmail.com]
> Sent: Tuesday, 7 October 2014 1:21 AM
> To: chris at cfbsoftware.com; ETH Oberon and related systems
> Subject: Re: [Oberon] Real-time multitasking using interrupt handlers
> > Wrong assumption - there is no obvious need for asm at all . One of
> > ARM's promotional points for the Cortex-M range of microcontrollers is
> > that no assembler is required and that all development can be done in
> > C. Whatever can be done in C can be done just as well (or better) in
> That sounds like a closed-system: all the I/O has [tried to] be catered for, and
> is hidden behind HLL. Like MacDonalds & MicroSoft: eat what we dish up ?
Nothing could be further from the truth. If MacDonalds had millions of items on their menu that allowed you to specify the number of seeds, their dimensions, type and their locations on the bun that might be a better analogy...
Open up the source code of the FPGA Project Oberon operating system and you will see that there is no assembler there:
Oberon is not only a powerful high-level language (HLL) it also has additional low-level features that can be used when you need to work directly with bits, bytes and memory-mapped hardware.
Even the simplest I/O devices these days (e.g. a temperature sensor) has a built-in processor / controller. You communicate with them via standard protocols like SPI or I2C. Most 32-bit microcontrollers, as well as having a microprocessor core, flash ROM and RAM also have SPI, I2C, ADC, DAC, UART etc. etc. controllers all on the chip itself.
Most of the time, programming these interfaces consists of setting and reading values of memory mapped locations. You do this using Oberon's SYSTEM.GET and SYSTEM.PUT functions (something like the PEEK and POKE of the bad old days).
Additionally Oberon's SET data type notation is ideal when you have to deal with specific bit numbers . E.g if the microcontroller manual says that the power to UART1 is controlled by setting bit 4 in the Power Control Register (PCONP, all you have to do is, write:
To switch on UART1.
Polling for a character from UART0 is not much more difficult:
PROCEDURE* GetCh*(VAR ch: CHAR);
REPEAT UNTIL SYSTEM.BIT(MCU.U0LSR, 0);
i.e. loop until bit zero of the UART Line Status Register (LSR) is set. Then retrieve the 8-bit byte from the UART Receiver Buffer Register (RBR). No assembler is required.
In case you are wondering, PCONP, U0LSR and U0RBR are just predefined constant addresses in an MCU module which we supply and which is tailored to each supported microcontroller:
PCONP* = 0400FC0C4H;
U0Base* = 04000C000H;
U0RBR* = U0Base+000H;
U0LSR* = U0Base+014H;
Oberon from Cortex-M4, M3 and ARM7
More information about the Oberon