This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to shorten execution time and reduce memory usage of code in ARM Cortex M3

Please i need help on shortening the execution time of the code or reduce the memory usage to improve the performance. currently the code has this as the results of the memory used but i want to reduce it and also change some instruction sets to shorten execution. pls what can i do ?

Total Read Only Size (Code +RO Data)

36(0.04kilobytes)

Total Read/Write size (Read/write data +Zero initialized data)

   0(0.00kilobytes)

Total ROM Size (code +RO+RW)

    36(0.04kilobytes)

; Calculation of a factorial value using a simple loop

; set up the exception addresses
THUMB
AREA RESET, CODE, READONLY
EXPORT __Vectors
EXPORT Reset_Handler
__Vectors
DCD 0x00180000 ; top of the stack
DCD Reset_Handler ; reset vector - where the program starts

AREA Task2a_Code, CODE, READONLY
Reset_Handler
ENTRY
start
MOV r1,#0 ; count the number of multiplications performed
MOV r2,#3 ; the final value in the factorial calculation
MOV r3,#1 ; the factorial result will be stored here

; loop r2 times forming the product
fact
ADD r1,r1,#1 ; find the next multiplicand
MUL r3,r1,r3 ; form the next product - note that MUL r3,r3,r1 gives unpredictable output
CMP r1,r2 ; check if the final value has been reached
BMI fact ; continue if all products have not been formed

exit ; stay in an endless loop
B exit
END

0