What's New in Astrobe for Cortex M4
Version 6.4.3 © 2014-2018 CFB Software
Last Updated 22 Sep 2018
This version is supported on Windows 10.
The Installation and Uninstall executables are now digitally signed to validate authenticity and integrity.
A summary of new features introduced in Astrobe for Cortex-M4 since version 6.0:
Oberon Language Features
The latest version of the Oberon Language Report is dated May 2016. A copy of the report is included in the Astrobe distribution.
The internal format of symbol files has been changed to remove some of the restrictions on imported items:
- Alias types and structured variables may now be imported.
- String constants and anonymous variables still cannot be imported but compiler error messages are now reported if you attempt to export them.
The following language rules are now verified:
- A compiler error message bad type is reported if ORD is called with a parameter other than CHAR, BOOLEAN or SET.
SYSTEM.VAL can be used to typecast REALs to INTEGERs.
INTEGERs and BYTEs are already assignment compatible with each other so ORD is not required.
- Shift operations are only valid for INTEGER (including BYTE) items. Any other use will result in an error message.
SET items can be typecast to INTEGER using ORD before shifting and typecast back to SET using BITS after shifting.
- Pointers to anonymous records are identified with a compiler warning message.
Anonymous records should be declared as named types if compatibility with Project Oberon is required.
- Arrays of CHAR or BYTE whose length is not a multiple of four bytes no longer have their length rounded up. However, the number of bytes allocated to store the array is still rounded up to be a multiple of four. For example:
Byte5 = ARRAY 5 OF BYTE;
Char5 = ARRAY 5 OF CHAR;
LEN(b) = 5
LEN(c) = 5
SYSTEM.SIZE(Byte5) = 8
SYSTEM.SIZE(Char5) = 8
NOTE: Previously, array out of bounds errors may have gone unnoticed because of this rounding. Now they will result in a runtime error e.g.
Byte10 = ARRAY 10 OF BYTE;
b := 99;
- Open array parameters can be copied to local arrays. The following code will work as long as the length of a is less than or equal to the length of a1.
IntArray = ARRAY 10 OF INTEGER;
PROCEDURE P(a: ARRAY OF INTEGER);
a1 := a
- A variable of any type can be passed to a parameter declared with a type ARRAY n OF BYTE as long as the variable has a size = n BYTES. For example:
Word = ARRAY 4 OF BYTE;
PROCEDURE WriteWord(w: Word);
FOR i := LEN(w) - 1 DO
Anonymous Pointer Types:
- Extensions of anonymous pointer types are no longer allowed e.g.
now results in an invalid extension error message. The record types should be declared as named types:
P0 = POINTER TO RECORD i: INTEGER END;
P1 = POINTER TO RECORD (P0) r: REAL END;
R0Desc = RECORD i: INTEGER END;
R1Desc = RECORD (R0Desc) r: REAL END;
P0 = POINTER TO R0Desc;
P1 = POINTER TO R1Desc;
Cortex-M4 Oberon Language Extensions and Features
The following language extensions and features target specific low-level features of the ARM Cortex-M4 microcontrollers:
- SYSTEM.EMIT Procedure
EMIT inserts the 32-bit value of any ARM Thumb-2 instruction at the current code location. Examples of its use can be seen in the source code of the Traps and IAP library modules.
- SYSTEM.IAP Procedure
IAP has been removed. Its use in the NXP-specific IAP library module has been replaced with a compatible series of calls to the SYSTEM functions LDREG and EMIT.
- STRLEN Procedure
STRLEN has been removed. Now that all strings are required to be null-terminated the
latest v6 library function Strings.Length is equally efficient and can be used instead. Alternatively (e.g. in leaf procedures) you can code Length(s) inline as follows:
strlen := 0; WHILE s[strlen] # 0X DO INC(strlen) END;
A new Auto Reset checkbox appears when UART0 is selected for the Upload Type configuration option. The checkbox controls whether or not the MCU is automatically reset whenever an upload to the device via the UART is completed. The default value is On which is consistent with the behaviour of previous versions of Astrobe. Clear this checkbox if you communicate with the MCU via the Astrobe Terminal and use its Reset button to reset the MCU.
STM32 Microcontrollers Modules and Examples
The following Cortex-M4 microcontrollers from STMicroelectronics are now supported:
New library modules and examples that target these devices are included:
- An updated common GPIO library module
- The standard Astrobe device-specific library modules: Clock, I2C, Main, MCU, Serial, SPI and Timers
- Additional examples
The corresponding Nucleo development boards from STMicroelectronics which use these microcontrollers have been added to our list of supported boards.
The size of the array Reserved which is declared in LinkOptions for use with NXP IAP functions has been reduced to 32 bytes because the remainder is allocated from the stack.
An identical implementation of the LinkOptions module is now common to all Cortex-M4 MCUs to simplify the linking process. The declaration can be commented out or removed if you do not use the NXP IAP functions.
GPIO (STM32 Targets)
The new General Purpose Input/Output (GPIO) module contains functions to configure the hardware characteristics, and control the behaviour, of each of the GPIO pins of an STM32 microcontroller. Refer to the Blinker examples to see how it is used.
The length parameter on SPI.Send and SPI.Receive has been removed. It is no longer required now that the length of the BYTE array is not rounded.
The module Timers contains functions for timed delays and for measuring elapsed execution time. Several different timers can be used in the same application. It replaces the previous Timer library module which only supported a single timer.
The Blinker examples demonstrate how it can be used. The steps are as follows:
- Declare a Timer variable for each different timer used:
- Call the Init function to associate this timer variable with your choice of hardware timer and specify whether it counts milliseconds or microseconds:
Timers.Init(msecTimer, Timers.TIM0, Timers.MSecs);
- When you call a timer function, pass the timer variable as a parameter to specify which timer is to be used:
For more details refer to the Blinker examples, and Section 3 Library Modules in the document
Oberon for Cortex-M4 Microcontrollers, supplied with Astrobe.
The configuration files have an additional Custom selection that allows
you to target microcontrollers (e.g. STM32 devices) other than the standard NXP
targets supported with Astrobe. When Custom is selected additional configuration
entries, Data Range and Code Range are enabled. These allow you to specify the Code and Data Flash and RAM address ranges to use when the Astrobe linker is used to produce the binary executable file.
The following variables in the LinkOptions module can be used to access these values in your applications:
Use of these variables can be seen in the ViewMemory and Info examples.
Developers targeting non-supported MCUs will need to develop their own versions
of the standard hardware-specific Astrobe library modules for more complex applications
and use 3rd-party tools to upload the executables to their development boards. The
latter are usually available from the designers of the MCU e.g. STMicroelectronics'
- Modules imported as aliases are now re-exported with their original names to prevent linker errors.
- Type tests other than for pointers and record parameters are reported as compilation errors.
- Cyclic imports are reported as build errors.
- The Stop button on the Upload UART dialog now functions correctly.
- Definition modules that exist are displayed when source code is not available e.g. when double-clicking on MAU or FPU in the Imports pane.
- Text in the Terminal output window automatically scrolls up when the text fills the window.
- The vertical scroll bar on the Terminal output window is always fully visible.
- Terminal splitter bar position initialisation is more reliable.
- References to loading during the link process have been renamed to linking.
- Correct code is now generated when a VAR parameter is used as the counter in a FOR statement. The implementation of FOR statements has been changed to correspond more closely to the equivalent WHILE statement as specified in the latest Oberon Language Report (Revision 1.10.2013 / 3.5.2016).
- Parameters are now passed correctly to procedures called from another procedure in cases where the code generated for the calling procedure exceeds 4 kB.
- Correct code is now generated for numeric / string CASE statements in the extreme case when maxCase – minCase + 1 = 256.
- The names of modules associated with resource files are limited to eight characters. The Linker reports longer resource module names as errors.
- The type tag of a RECORD VAR parameter is now passed correctly when used as a VAR parameter to another procedure.
- Corrected the IRQTimer examples.
- The internal test menu item Sym Listing has been hidden.
- The linker displays an error if the LinkOptions module is included in the executable but is not the first module loaded. It should be the first module to appear in the IMPORT list of module Main.
- The invalid constant declaration CONST LEN = LEN(INTEGER) now reports an error message instead of raising an exception.
- Unexpected compiler exceptions now report the exception error message and procedure call traceback details.
- Constant values can no longer be passed to procedures that expect a VAR BYTE parameter. The compiler now reports the error message: "variable expected".
- Correct code is now generated for addresses of record and multi-dimensional array elements where the element offset size is > 1 KB
- Disassembler syntax for MLA instruction is now consistent with the ARM Cortex-M documentation:
MLA Rd, Rm, Rm, Ra
where Rd = Rm * Rn + Ra
- Correct code is now generated for:
FOR loops with a BYTE counter
CASE statements in leaf procedures
INC, DEC, INCL, EXCL procedure calls in leaf procedures
- Constant expressions (e.g. ORD(ch)) are allowed as CASE labels.
- Additional bars before the first, or after the last, case are allowed in CASE statements.
- Assignments to REAL global array variables and the SYSTEM.SQRT function now generate correct code when used in leaf procedures.
- SYSTEM.STRLEN was generating incorrect code and has been removed. See above for alternatives.