mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-09 22:08:42 +02:00
Add files via upload
This commit is contained in:
@@ -1,78 +1,73 @@
|
|||||||
@echo off
|
@echo off
|
||||||
REM ==============================================================================
|
REM ==============================================================================
|
||||||
REM FILE: build.bat
|
REM FILE: build.bat
|
||||||
REM
|
REM
|
||||||
REM DESCRIPTION:
|
REM DESCRIPTION:
|
||||||
REM Build script for RP2350.
|
REM Build script for RP2350.
|
||||||
REM Automates the process of assembling, linking, and generating UF2 firmware.
|
REM
|
||||||
REM
|
REM BRIEF:
|
||||||
REM AUTHOR: Kevin Thomas
|
REM Automates the process of assembling, linking, and generating UF2 firmware.
|
||||||
REM CREATION DATE: October 5, 2025
|
REM
|
||||||
REM UPDATE DATE: October 5, 2025
|
REM AUTHOR: Kevin Thomas
|
||||||
REM
|
REM CREATION DATE: October 5, 2025
|
||||||
REM STEPS:
|
REM UPDATE DATE: October 5, 2025
|
||||||
REM 1. Assemble source files (gpio16_blink.s, image_def.s)
|
REM ==============================================================================
|
||||||
REM 2. Link objects with linker script (linker.ld)
|
|
||||||
REM 3. Convert ELF to BIN
|
echo Building GPIO16 blink...
|
||||||
REM 4. Convert BIN to UF2 with correct family ID (RP2350 = 0xe48bff59)
|
|
||||||
REM 5. Provide flashing instructions (UF2 drag‑and‑drop or OpenOCD)
|
REM ==============================================================================
|
||||||
REM ==============================================================================
|
REM Assemble Source Files
|
||||||
|
REM ==============================================================================
|
||||||
echo Building GPIO16 blink...
|
arm-none-eabi-as -mcpu=cortex-m33 -mthumb main.s -o gpio16_blink.o
|
||||||
|
if errorlevel 1 goto error
|
||||||
REM ==============================================================================
|
|
||||||
REM Assemble source files
|
arm-none-eabi-as -mcpu=cortex-m33 -mthumb image_def.s -o image_def.o
|
||||||
REM ==============================================================================
|
if errorlevel 1 goto error
|
||||||
arm-none-eabi-as -mcpu=cortex-m33 -mthumb main.s -o main.o
|
|
||||||
if errorlevel 1 goto error
|
REM ==============================================================================
|
||||||
|
REM Link Object Files
|
||||||
arm-none-eabi-as -mcpu=cortex-m33 -mthumb image_def.s -o image_def.o
|
REM ==============================================================================
|
||||||
if errorlevel 1 goto error
|
arm-none-eabi-ld -T linker.ld gpio16_blink.o image_def.o -o gpio16_blink.elf
|
||||||
|
if errorlevel 1 goto error
|
||||||
REM ==============================================================================
|
|
||||||
REM Link object files into ELF using linker script
|
REM ==============================================================================
|
||||||
REM ==============================================================================
|
REM Create Raw Binary from ELF
|
||||||
arm-none-eabi-ld -T linker.ld gpio16_blink.o image_def.o -o gpio16_blink.elf
|
REM ==============================================================================
|
||||||
if errorlevel 1 goto error
|
arm-none-eabi-objcopy -O binary gpio16_blink.elf gpio16_blink.bin
|
||||||
|
if errorlevel 1 goto error
|
||||||
REM ==============================================================================
|
|
||||||
REM Create raw binary from ELF
|
REM ==============================================================================
|
||||||
REM ==============================================================================
|
REM Create UF2 Image for RP2350
|
||||||
arm-none-eabi-objcopy -O binary gpio16_blink.elf gpio16_blink.bin
|
REM -b 0x10000000 : base address
|
||||||
if errorlevel 1 goto error
|
REM -f 0xe48bff59 : RP2350 family ID
|
||||||
|
REM ==============================================================================
|
||||||
REM ==============================================================================
|
python uf2conv.py -b 0x10000000 -f 0xe48bff59 -o gpio16_blink.uf2 gpio16_blink.bin
|
||||||
REM Create UF2 image for RP2350
|
if errorlevel 1 goto error
|
||||||
REM -b 0x10000000 : base address
|
|
||||||
REM -f 0xe48bff59 : RP2350 family ID
|
REM ==============================================================================
|
||||||
REM ==============================================================================
|
REM Success Message and Flashing Instructions
|
||||||
python uf2conv.py -b 0x10000000 -f 0xe48bff59 -o gpio16_blink.uf2 gpio16_blink.bin
|
REM ==============================================================================
|
||||||
if errorlevel 1 goto error
|
echo.
|
||||||
|
echo =================================
|
||||||
REM ==============================================================================
|
echo SUCCESS! Created gpio16_blink.uf2
|
||||||
REM Success message and flashing instructions
|
echo =================================
|
||||||
REM ==============================================================================
|
echo.
|
||||||
echo.
|
echo To flash via UF2:
|
||||||
echo =================================
|
echo 1. Hold BOOTSEL button
|
||||||
echo SUCCESS! Created gpio16_blink.uf2
|
echo 2. Plug in USB
|
||||||
echo =================================
|
echo 3. Copy gpio16_blink.uf2 to RP2350 drive
|
||||||
echo.
|
echo.
|
||||||
echo To flash via UF2:
|
echo To flash via OpenOCD (debug probe):
|
||||||
echo 1. Hold BOOTSEL button
|
echo openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000" -c "program gpio16_blink.elf verify reset exit"
|
||||||
echo 2. Plug in USB
|
echo.
|
||||||
echo 3. Copy gpio16_blink.uf2 to RP2350 drive
|
goto end
|
||||||
echo.
|
|
||||||
echo To flash via OpenOCD (debug probe):
|
REM ==============================================================================
|
||||||
echo openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000" -c "program gpio16_blink.elf verify reset exit"
|
REM Error Handling
|
||||||
echo.
|
REM ==============================================================================
|
||||||
goto end
|
:error
|
||||||
|
echo.
|
||||||
REM ==============================================================================
|
echo BUILD FAILED!
|
||||||
REM Error handling
|
echo.
|
||||||
REM ==============================================================================
|
|
||||||
:error
|
:end
|
||||||
echo.
|
|
||||||
echo BUILD FAILED!
|
|
||||||
echo.
|
|
||||||
|
|
||||||
:end
|
|
||||||
|
|||||||
Reference in New Issue
Block a user