This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding README updates and sifter exercise
- Loading branch information
Showing
6 changed files
with
228 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ "name": "Pico Debug", | ||
"device": "RP2040", | ||
"gdbPath": "${env:GDB_PATH}", | ||
"cwd": "${workspaceRoot}", | ||
"executable": "${command:cmake.launchTargetPath}", | ||
"request": "launch", | ||
"type": "cortex-debug", | ||
"servertype": "openocd", | ||
"configFiles": [ | ||
"interface/cmsis-dap.cfg", | ||
"target/rp2040.cfg" | ||
], | ||
"searchDir": [ | ||
"${env:OPENOCD_PATH}/tcl" | ||
], | ||
"openOCDLaunchCommands": [ | ||
"adapter speed 5000" | ||
], | ||
"runToEntryPoint": "main", | ||
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", | ||
"postRestartCommands": [ | ||
"break main", | ||
"continue" | ||
], | ||
"showDevDebugOutput": "parsed" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
// These settings tweaks to the cmake plugin will ensure | ||
// that you debug using cortex-debug instead of trying to launch | ||
// a Pico binary on the host | ||
"cmake.statusbar.advanced": { | ||
"debug": { | ||
"visibility": "hidden" | ||
}, | ||
"launch": { | ||
"visibility": "hidden" | ||
}, | ||
"build": { | ||
"visibility": "hidden" | ||
}, | ||
"buildTarget": { | ||
"visibility": "hidden" | ||
} | ||
}, | ||
"cmake.buildBeforeRun": true, | ||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", | ||
"cortex-debug.openocdPath": "${env:OPENOCD_PATH}/src/openocd", | ||
"cortex-debug.variableUseNaturalFormat": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cmake_minimum_required(VERSION 3.18) | ||
include($ENV{PICO_SDK_PATH}\\external\\pico_sdk_import.cmake) | ||
|
||
project(program C CXX ASM) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
include_directories(${CMAKE_SOURCE_DIR}) | ||
|
||
add_executable(${PROJECT_NAME} | ||
program.S | ||
sifter.S | ||
) | ||
|
||
set(PICO_BOARD pico_w) | ||
|
||
pico_sdk_init() | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
pico_stdlib | ||
) | ||
|
||
pico_add_extra_outputs(${PROJECT_NAME}) | ||
|
||
pico_enable_stdio_usb(${PROJECT_NAME} 1) | ||
pico_enable_stdio_uart(${PROJECT_NAME} 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.thumb_func @ Necessary because sdk uses BLX | ||
.global main @ Provide program starting address | ||
|
||
main: | ||
BL stdio_init_all | ||
MOV R4, #0 | ||
LDR R5, =numbers | ||
LDR R6, =size | ||
|
||
load: | ||
@ TODO: Set up stack frame for load function | ||
LDR R7, [R5, R4] | ||
ADD R4, #4 | ||
@ TODO: Branch and link to the sifter | ||
CMP R4, R6 | ||
BNE load | ||
|
||
rest: | ||
NOP | ||
B rest | ||
|
||
.data | ||
numbers: .word 255, 1426063615, 855638271, 0, 1140850943 | ||
end: | ||
.set size, end - numbers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.thumb_func | ||
.global sifter | ||
|
||
sifter: | ||
@ TODO: Prepare stack frame for sifter | ||
LDR R0, =format | ||
MOV R1, R7 | ||
@ TODO: Branch and Link to determine_type | ||
@ TODO: Branch and Link to determine_quality | ||
BL printf | ||
@ TODO: Pop appropriate registers to... | ||
@ TODO: Branch and eXecute back to subroutine calling this one (caller) | ||
|
||
determine_type: | ||
@ TODO: Prepare stack frame for determine_type | ||
@ TODO: Shift appropriate direction(s) to get the type bits | ||
@ TODO: Compare and branch to appropriate typing branches | ||
|
||
is_lunar_type: | ||
LDR R2, =lunar | ||
@ TODO: Pop from stack to get address of caller | ||
@ TODO: Branch and eXecute to caller | ||
|
||
is_martian_type: | ||
LDR R2, =martian | ||
@ TODO: Pop from stack to get address of caller | ||
@ TODO: Branch and eXecute to caller | ||
|
||
determine_quality: | ||
@ TODO: Set up stack frame for determine_quality | ||
@ TODO: Shift appropriate places and direction(s) to get quality bits | ||
@ TODO: Compare and branch to correct quality branch | ||
|
||
hi_quality: | ||
LDR R3, =hi_qual | ||
@ TODO: Pop from stack to get address of caller | ||
@ TODO: Branch and eXecute to caller | ||
|
||
lo_quality: | ||
LDR R3, =lo_qual | ||
@ TODO: Pop from stack to get address of caller | ||
@ TODO: Branch and eXecute to caller | ||
|
||
.data | ||
format: .asciz "0x%08x\tTYPE: %s\tQUALITY: %s\n" | ||
lunar: .asciz "LUNAR" | ||
martian: .asciz "MARTIAN" | ||
hi_qual: .asciz "HI" | ||
lo_qual: .asciz "LO" |