-
Notifications
You must be signed in to change notification settings - Fork 12
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
1 parent
1aec542
commit 707bba0
Showing
17 changed files
with
1,386 additions
and
33 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
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 |
---|---|---|
@@ -1,26 +1,51 @@ | ||
#!/bin/sh | ||
|
||
WORKDIR=$PWD | ||
STARTUP_DIR=${WORKDIR}/../src/startup/rp2350 | ||
PICO_SDK_PATH=pico-sdk | ||
if [ ! -e ${PICO_SDK_PATH} ]; then | ||
git clone --branch=develop --depth=1 https://github.com/raspberrypi/pico-sdk ${PICO_SDK_PATH} | ||
fi | ||
cd ${PICO_SDK_PATH}/src | ||
|
||
prep() { | ||
prep_boot2() { | ||
arm-none-eabi-gcc -E \ | ||
-I${WORKDIR}/include \ | ||
-Icommon/pico_base_headers/include \ | ||
-Irp2350/pico_platform/include \ | ||
-Irp2_common/pico_platform_compiler/include \ | ||
-Irp2_common/pico_platform_panic/include \ | ||
-Irp2_common/pico_platform_sections/include \ | ||
-Irp2350/pico_platform/include \ | ||
-Irp2350/hardware_regs/include \ | ||
-Irp2350/hardware_structs/include \ | ||
-Irp2350/boot_stage2/asminclude \ | ||
rp2350/boot_stage2/boot2_$1.S >${WORKDIR}/../boot2/generated/boot2__rp2350_$1.S | ||
echo "$1" | ||
} | ||
|
||
prep generic_03h | ||
prep w25q080 | ||
prep_crt0() { | ||
if [ ! -d ${STARTUP_DIR} ]; then | ||
mkdir -p ${STARTUP_DIR} | ||
fi | ||
|
||
arm-none-eabi-gcc -E \ | ||
-I${WORKDIR}/include \ | ||
-Icommon/pico_base_headers/include \ | ||
-Icommon/pico_binary_info/include \ | ||
-Icommon/boot_picobin_headers/include \ | ||
-Irp2_common/pico_platform_compiler/include \ | ||
-Irp2_common/pico_platform_panic/include \ | ||
-Irp2_common/pico_platform_sections/include \ | ||
-Irp2_common/boot_bootrom_headers/include \ | ||
-Irp2_common/pico_bootrom/include \ | ||
-Irp2350/pico_platform/include \ | ||
-Irp2350/hardware_regs/include \ | ||
-Irp2350/hardware_structs/include \ | ||
rp2_common/pico_crt0/crt0.S >${STARTUP_DIR}/crt0.S | ||
echo "crt0" | ||
} | ||
|
||
prep_boot2 generic_03h | ||
prep_boot2 w25q080 | ||
|
||
prep_crt0 |
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,55 @@ | ||
#!/bin/sh | ||
|
||
TRIPLE=riscv64-unknown-elf | ||
CC=${TRIPLE}-gcc | ||
WORKDIR=${PWD} | ||
STARTUP_DIR=${WORKDIR}/../src/startup/rp2350 | ||
PICO_SDK_PATH=pico-sdk | ||
if [ ! -e ${PICO_SDK_PATH} ]; then | ||
git clone --branch=develop --depth=1 https://github.com/raspberrypi/pico-sdk ${PICO_SDK_PATH} | ||
fi | ||
cd ${PICO_SDK_PATH}/src | ||
|
||
prep_boot2() { | ||
${CC} -E \ | ||
-I${WORKDIR}/include \ | ||
-Icommon/pico_base_headers/include \ | ||
-Irp2_common/pico_platform_compiler/include \ | ||
-Irp2_common/pico_platform_panic/include \ | ||
-Irp2_common/pico_platform_sections/include \ | ||
-Irp2_common/hardware_hazard3/include \ | ||
-Irp2350/pico_platform/include \ | ||
-Irp2350/hardware_regs/include \ | ||
-Irp2350/hardware_structs/include \ | ||
-Irp2350/boot_stage2/asminclude \ | ||
rp2350/boot_stage2/boot2_$1.S >${WORKDIR}/../boot2/generated/boot2__rp2350_$1.S | ||
echo "$1" | ||
} | ||
|
||
prep_crt0() { | ||
if [ ! -d ${STARTUP_DIR} ]; then | ||
mkdir -p ${STARTUP_DIR} | ||
fi | ||
|
||
${CC} -E \ | ||
-I${WORKDIR}/include \ | ||
-Icommon/pico_base_headers/include \ | ||
-Icommon/pico_binary_info/include \ | ||
-Icommon/boot_picobin_headers/include \ | ||
-Irp2_common/pico_platform_compiler/include \ | ||
-Irp2_common/pico_platform_panic/include \ | ||
-Irp2_common/pico_platform_sections/include \ | ||
-Irp2_common/boot_bootrom_headers/include \ | ||
-Irp2_common/pico_bootrom/include \ | ||
-Irp2_common/hardware_hazard3/include \ | ||
-Irp2350/pico_platform/include \ | ||
-Irp2350/hardware_regs/include \ | ||
-Irp2350/hardware_structs/include \ | ||
rp2_common/pico_crt0/crt0_riscv.S >${STARTUP_DIR}/crt0_riscv.S | ||
echo "crt0_riscv" | ||
} | ||
|
||
prep_boot2 generic_03h | ||
prep_boot2 w25q080 | ||
|
||
prep_crt0 |
File renamed without changes.
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
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
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,70 @@ | ||
-- | ||
-- Copyright 2021 (C) Jeremy Grosser | ||
-- | ||
-- SPDX-License-Identifier: BSD-3-Clause | ||
-- | ||
with RP2350_SVD.TIMER0; use RP2350_SVD.TIMER0; | ||
|
||
package body RP.Timer is | ||
function Clock | ||
return Time | ||
is | ||
-- This implementation uses the non-latching TIMERAWH and TIMERAWL | ||
-- registers in order to be safe for concurrent access. | ||
Next_High : UInt32; | ||
High : UInt32; | ||
Low : UInt32; | ||
begin | ||
High := TIMER0_Periph.TIMERAWH; | ||
Low := TIMER0_Periph.TIMERAWL; | ||
Next_High := TIMER0_Periph.TIMERAWH; | ||
|
||
if Next_High /= High then | ||
-- If TIMERAWH changed while we were reading TIMERAWL it means that at | ||
-- some point between the two reads TIMERAWL overflowed and the values | ||
-- where: | ||
-- - TIMERAWL = 0 | ||
-- - TIMERAWH = Next_High | ||
-- | ||
-- These values denote a valid point in time between the call and the | ||
-- return of this function. | ||
|
||
Low := 0; | ||
High := Next_High; | ||
end if; | ||
|
||
return Time (Shift_Left (UInt64 (High), 32) or UInt64 (Low)); | ||
end Clock; | ||
|
||
procedure Busy_Wait_Until (Deadline : Time) is | ||
DL_High : constant UInt32 := | ||
UInt32 (Shift_Right (Deadline, 32) and 16#FF_FF_FF_FF#); | ||
DL_Low : constant UInt32 := | ||
UInt32 (Deadline and 16#FF_FF_FF_FF#); | ||
|
||
High : UInt32 := TIMER0_Periph.TIMERAWH; | ||
begin | ||
loop | ||
High := TIMER0_Periph.TIMERAWH; | ||
exit when High >= DL_High; | ||
end loop; | ||
|
||
while High = DL_High and then TIMER0_Periph.TIMERAWL < DL_Low loop | ||
High := TIMER0_Periph.TIMERAWH; | ||
end loop; | ||
|
||
end Busy_Wait_Until; | ||
|
||
function Milliseconds | ||
(T : Natural) | ||
return Time | ||
is ((Ticks_Per_Second / 1_000) * Time (T)); | ||
|
||
procedure Set_Debug_Pause | ||
(Core_0, Core_1 : Boolean) | ||
is | ||
begin | ||
TIMER0_Periph.DBGPAUSE.DBG := (As_Array => True, Arr => (0 => Core_0, 1 => Core_1)); | ||
end Set_Debug_Pause; | ||
|
||
end RP.Timer; |
File renamed without changes.
Oops, something went wrong.