jordanbent / cortex-arm-learning

MIT License
2 stars 1 forks source link

Cortex-ARM Learning

Cortex-ARM Learning is a VSCode Debugger extension intended to be used with ARM Assembly Language programs.

The debugger is built off of the existing extension Cortex Debug.

Cortex-ARM Learning is equipt with additional UI features that will aid early-stage programmers with the learning of Assembly Langugage and the concepts that are involved.

Features

Build Button

build

Build button can be found on the bottom left of the Status Bar of your VSCode Window.

Note: the button will only appear once the debugger is activated but will remain when debugger is exited.

Build Button Functionality

Builds your ARM Project. Any errors in your ARM code, found in your main.s file, will appear here. Once the project has built the project is ready to be debugged.

Register View

RegisterView

The register window appears once you are debugging. It shows the values of all registers avaliable to ARM.

Register View Functionality

Shows the values of the register in:

Performance Counter

counter

The performance counter can be found in the left-side window along with the register view. It shows the current cost of the program,in main.s, in instruction cycles.

Stack Interface

Stack

The stack interface window appears once you are debugging. Once initialised, the current Stack Pointer {SP} is shown at the top of the stack.

Stack Functionality

Following the live stack pointer, any values that are pushed onto or popped off of the stack, their memory values are shown. While the current stack pointer is pointed to.

Note: The stack window physically grows upwards when pushed onto, but note that the stack pointer value is decreasing in value.

Array Interface

Ctrl + Shift + P to open commands.

allcommands

Selecting Cortex-ARM Array command

array1

Enter the hexidecimal start address of the array. Example:

array2

Enter the element size of the elements of your array.

array3

Example:

array4

Enter the dimensions of your array. Like a standard high-level language array where; array[i,j]. Enter your array ny number of rows followed by a comma, followed by the number of columns.

Note: If your are working with a 1-D array just input one number: the length of the array.

array5

Example where array = [5,4]

array6

Enter how you would like the values of the array to be displayed. For decimal numbers, you can view in decimal. For a word, you can view in ascii.

array7

Example:

array8

Result:

arrayRes

Reference Table

This opens a text document that holds:

Other

These features are all in addition to the already existing features of the debugger which include the following:

Setup

VS Code

Install this extension.

Ctrl + Shift + P to open commands.

ARM Assembly Project File

Use CortexARM Project File when creating your project file to debug. Edit only the main.s file.

Environment

To setup your VSCode to be able to run Assembly Code through a board. Further documentation can be found at this tutorial.

VSARM Folder

Create a folder in your C drive: 'C:', named VSARM to hold all downloads in the same directory.

GNU Toolchain

This is our compiler to use to compile ARM Assembly Code.

Download file indicated gcc-arm-none-eabi-9-2019-q4-major-win32.exe

Note: Download file to C:\VSARM.

Rename download foler, in C:\VSARM, to: armcc.

Then you must add the following path:

C:\VSARM\armcc\bin

to your PATH variable located in the System Variables in your system's Enviornment Variables. To see how to do this follow the tutorial.

Note: The command is run while the current dierctory is C:

STLink to JLink

STLink and JLink are links used to communicate between your board and your computer. If your board is configured with STLink, change it to JLink.

Flash board to be used with JLink rather than STLink using STLink Reflash. Using option (1)Upgrade to JLink.

JLink

Download J-Link Software and Documentation Pack

Note: Download file to C:\VSARM.

Board

Currently Setup for STM32F411 Cortex M-4 core.

If have a different version of the board, find .svd file and add to .ignore file and in vscode folder, change launch file for project, according to your board.

Contributing

Pull requests are welcome.

Acknowledgments

This extension is built upon Marcus's (marcus25) Cortex Debug extension (https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug). His project provided an excellent debugger.