Code Monkey home page Code Monkey logo

oof2's Introduction

oof2

Mangle "blocked RAM" (0x210xxxxx) payloads, so the RP2 bootrom can load it.

Normally the blocked_ram CMake option produces binaries at 0x200xxxxx which is whitelisted in the RP2 bootrom, but if you're already pushing the limits of the hardware, and have optimized RAM bank usage to the extreme, striped RAM just doesn't cut it. Since there is the mistake in bootrom code not whitelisting unstriped RAM mirror, the binary has to be mangled before it can be loaded. Another unfortunate side-effect is that the code can't be executed directly, but a stub has to be injected into BANK4 or BANK5, which is actually just a copypaste of the entrypoint code. This is required, because the code expects execution to begin at 0x21000000 |1, whereas due to the mangling, code starts at 0x20000000 |1 instead, which is bad.

Repo contents

  • elf2uf2.diff - you must sadly apply this patch to ${PICO_SDK_PATH}/tools/elf2uf2/main.cpp to force it to generate a valid .uf2, but one which the bootrom doesn't accept
  • bootcode.S - use ARMIPS to assemble the injected payload launcher
    • stage1.bin and stage2.bin - preassembled stage payloads, so ARMIPS doesn't need to be acquired for this purpose only, but they can be reassembled just fine by running armips bootcode.S
  • link.ld - copy link.ld into your project folder, and put pico_set_linker_script(programname ${CMAKE_CURRENT_LIST_DIR}/link.ld) in your CMakeLists.txt
  • oof2.py - main mangler script; run it to see how to use it

Usage

Prerequisites:

  • patch elf2uf2 with elf2uf2.diff
  • assemble patched bootcode with armips bootcode.S
  • setup project linker script to be link.ld from this repo

After every build:

  • run python3 programname.uf2 D:\\asd.uf2 where programname.uf2 is the generated .uf2 you want to upload, and D:\\ is where the pico bootrom shows up as an MSC USB device
    • alternatively just patch the .uf2 into the current folder, and deal with it later somehow else

oof2's People

Contributors

sonosoos avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.