How to run only assembly code on Keil version 5, referencing the book Arm Assembly Language
text for main.s
;-------------------------------------------------------------------
; ---The program template below allows for only Assembly ---------
;--------code without hardware requirements on Keil-----------------
;-------------------------------------------------------------------
; Because Keil does not formally support building projects in
; assembly only, we have to start a template that allows
; us to run only assembly code, below is one template.
; This is a great tool for learning Assembly language on Keil.
;-------------------------------------------------------------------
AREA VECTORS, DATA, READONLY
EXPORT __Vectors
EXPORT Reset_Handler
__Vectors
DCD 0x20001000 ; Initial Stack Pointer
DCD Reset_Handler ; Reset Handler address
; --------------------------------------------------------------------
; -----------Why the code above is used-----------------------------
;---------------------------------------------------------------------
; The above code is to run bare Assembly
; Similar to the AAL book, but modified,
; Modification was required
; Due to using version 5.0, the book uses 4.73
;
; Note: Ignore putting a colon after every label
; because Keil prefers no colon after the label, colon
; is optional, but it makes debugging trickier.
;---------------------------------------------------------------------
;----------------------------------------------------------------------
;--------------------Start of an Array---------------------------------
; Can delete this array if not needed
;----------------------------------------------------------------------
AREA MYDATA_RO, DATA, READWRITE ; because will write an array
ALIGN
AddressArray
;--------------------------------------------------------
; Can add elements into the array, or change the current
;--------------------------------------------------------
DCD 0x00000000 ; Element 0 loaded in Array
DCD 0x00000000 ; Element 1 loaded in Array
AddressArray_End ; this label marks the end of the array
;----------------------------------------------------------------------
;-------------------End of the Array-----------------------------------
; Can delete the array above if not needed
;-----------------------------------------------------------------------
AREA MYCODE, CODE, READONLY ; because we will only be reading in code below
THUMB
ENTRY
Reset_Handler
; -----------------------------------------------------------
; ------------------Start of MYCODE------------------------
; can delete anything below and write own Assembly code
;------------------------------------------------------------
LDR R0, =AddressArray ; load R0 first
MOV R1, #10
CoreOneTask
STR R1, [R0, #0] ; 10 = AddressArray [0]
B mainTwo
CoreTwoTask
LDR R2, [R0, #0] ; R2 = AddressArray[0]
LSL R2, R2, #1 ; R2 = AdressArray[0] * 2
STR R2, [R0, #4] ; 10 * 2 = AddressArray[1]
B mainEnd
;Main() calling it now
mainOmne
BL CoreOneTask
mainTwo
BL CoreTwoTask
mainEnd
LDR R7, [R0, #0] ; SharedData[0] = 10
LDR R8, [R0, #4] ; SharedData[1] = 10 * 2 = 80
;------------------------------------------------------------
;------------------End of MYCODE-----------------------------
; can delete anything above and write your own assembly code
;-------------------------------------------------------------
Loop
B Loop ; this is used for debugging purposes
END