Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in Arm Cortex M0+ assembly language to evaluate the performance of the Bubble Sort algorithm concerning array size. To start, create a

Write a program in Arm Cortex M0+ assembly language to evaluate the performance of the Bubble Sort algorithm concerning array size. To start, create a timer interrupt with the following parameters: the microcontroller frequency is 10Mhz and the timer interrupt period is 4ms. By employing this timer interrupt alongside the SysTick Timer parameters, you can extract the microcontroller's running time (in microseconds).

The provided pseudo code outlines the main function's structure. Your task involves implementing a program that sorts an array using the Bubble Sort algorithm and records execution times according to the element count. The numbers (unsigned) to be sorted are available in "array.txt," and they need to be integrated into your program in the specified sequence. Upon completion, the memory address of the sorted array should be stored in the R0 register, while the memory address of the execution times array should be stored in the R1 register. The program should also save the sorted array and execution times to the memory.

Hint: In the BubbleSort function, make sure to copy only the first 'i' elements of the array into memory. Avoid moving beyond the specified parameter to ensure the function operates within the designated range.

The pseudocode:

void main () { //Initialize System Tick Timer to generate interrupt Init SysTick Timer () ; for (int i=2; i<=ARRAY_SIZE; i++) { //Record the current running time on the microcontroller as the start time. Save_Start_Time () ; //Run Bubble sort algorithm for the first i elements of array. BubbleSort (i) ; //Calculate execution time of BubbleSort function using start time Save_Execution_Time (); } //Stop to System Tick Timer and clear interrupt configuration. Stop SysTick Timer () ; while (1); }

The code should work in Keil Vision IDE v5.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

Students also viewed these Databases questions