Assembler Directives to Specify RAM Area and Code Area | Cypress Semiconductor
Support & Community
Assembler Directives to Specify RAM Area and Code Area
What are the reserved words in assembler to designate code and data areas?
Following directives should be used before declaring variables and code in assembly. The parentheses should have RAM, ROM, REL, CON, ABS, OVR as required. AREA bss() will not have
area bss(ram) is the directive used when variables has to be declared in RAM.
area text(rom) is the directive used when code is written. After using the "area bss(ram)" and declaring variables, "area text(rom)" has to be used before entering code.
So, the general order would be:
1: Include your files first:
include "m8c.inc" // include m8c specific declarations
include "psocapi.inc" // include User Module API specific declarations.
2: Make your variables global (if required):
export _main // main is global
3: Declare your variables:
area bss(RAM) // inform assembler that variables follow
SomeVar1: blk 2 // 2 bytes in size
SomeVar2: blk 1 // 1 byte in size
4: Start with your code:
area text(ROM,REL) // inform assembler that program code follows
M8C_EnableGInt // Enable Global interrupts