The contributor centre is in English only.
AS003: Memory layout for variables
This specification describes the layout for the memory space of variables, as generated by the Aseba target and compiler.
- Status
- Updated according to commit commit 0250a033.
- Design by
- Stéphane Magnenat and Philippe Rétornaz (original layout), Florian Vaussard (generalization of temporary variables)
- Written by
- Florian Vaussard
A summary of the memory space is shown below (click on it to enlarge).
The memory is first filled by the target's variables, defined in the firmware of the robot. The first variables, beginning from address 0x0000, are id, event.source and event.args[32]. They are mandatory on all real Aseba targets. Then fwversion[2] and productid are implemented on most Aseba targets. The target defines also a number N of application-specific variables.
The variables defined by the user are then piled up on the target's variables, assuming there is enough free space left.
Finally, the compiler can require a number of temporary variables, for example when executing expressions involving arrays. For example in
call math.add(i, [1,2,3], foo[1:3]*[2,2,2])
a first temporary vector is created to store the vector [1,2,3], and a second vector is created to store the result of foo[1:3]*[2,2,2].
Temporary variables are only created in the context of statements. When the statement has been executed, all temporary variables are deallocated. This allocation is done statically in the parser.
References
- ASEBA Meets D-Bus: From the Depths of a Low-Level Event-Based Architecture into the Middleware Realm The architecture was first described here.
- The figure is available in the Aseba Git repository here.