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.
- Loading branch information
Showing
4 changed files
with
122 additions
and
0 deletions.
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
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": true | ||
} |
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,26 @@ | ||
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 | ||
) | ||
|
||
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,42 @@ | ||
.thumb_func @ Necessary because sdk uses BLX | ||
.global main @ Provide program starting address | ||
|
||
main: | ||
BL stdio_init_all @ initialize uart or usb | ||
LDR R0, =polarities | ||
MOV R3, #0 @ count of negative values | ||
MOV R4, #0 @ count of positive values | ||
MOV R5, #0 @ largest negative value | ||
MOV R6, #0 @ largest positive value | ||
MOV R7, #0 | ||
|
||
polarity: | ||
@ TODO: Load the array size location | ||
@ TODO: Keep track of amount of numbers | ||
@ TODO: Compare the amount of numbers seen to size | ||
@ TODO: If numbers are equal, then we're done -- go to print | ||
@ TODO: If not, load the number from the array | ||
@ TODO: Find out if number is negative or non-negative | ||
@ TODO: Branch to correct handler | ||
|
||
@ TODO: Handle negative numbers | ||
@ TODO: Record max negative number | ||
@ TODO: Handle positive numbers | ||
@ TODO: Record max positive number | ||
@ TODO: Move to next entry | ||
|
||
@ TODO: Print results | ||
|
||
rest: | ||
NOP | ||
B rest | ||
|
||
.data | ||
format_pos: .asciz "POSITIVES: %d; MAX: %d\n" | ||
format_neg: .asciz "NEGATIVES: %d; MAX: %d\n" | ||
polarities: .byte 10, 88, -30, 98, 83, 29, -85, 36, -26, 79, 39, -35 | ||
.byte 62, 40, 26, 33, -14, 12, -17, 64, -43, 57, 17, -88 | ||
.byte -18, 82, -34, -7, -72, -42, -96, -70, -62, -45, -25, 9 | ||
.byte 6, -48, -47, -100, -90, 44, -27, -65, 92, 1, -1, -49 | ||
end: | ||
.set size, end - polarities |