Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.raspberry-pi > #35916

Re: RP2040 reset idea

Newsgroups comp.sys.raspberry-pi, sci.electronics.design
Subject Re: RP2040 reset idea
References <biphejl03r86ebf5dkpcav9ud7u8vcjclj@4ax.com> <b+f*To1Uz@news.chiark.greenend.org.uk> <jidrej5t93mud6asmgvis4rcetolmqa6ta@4ax.com> <vclv4m$1he37$2@dont-email.me>
From dplatt@coop.radagast.org (Dave Platt)
Message-ID <0be4sk-4bp.ln1@coop.radagast.org> (permalink)
Date 2024-09-21 20:08 -0700

Cross-posted to 2 groups.

Show all headers | View raw


In article <vclv4m$1he37$2@dont-email.me>,
The Natural Philosopher  <tnp@invalid.invalid> wrote:
>It gets nastier if you want to preserve config info across reboots.
>It is possible to read and write areas of flash from the code, but its 
>no picnic.

True.  From what I read in the SDK, it appears that the second core
has to be halted temporarily (pushed into a loop running only in SRAM),
and the core doing the erase/flash also has to be running out of SRAM.
Neither can be doing XIP during the flashing, as things will go FOOM
if they are.

>And it gets wiped when new code is uploaded

That may be true of the drag-and-drop-a-UF2-file method.

It's not necessarily true if you use the "picotool" app to
speak directly to the ROM bootloader code.

A little RP2040 (RPi Pico) app I've been working on, uses the
last 32k or so of flash as a bank of "saved parameter" regions,
with version/revision numbers.  My app fits down in the bottom
200k of flash, so there's no collision between the two.

I've reflashed the proto with new versions of the app dozens
of times, and the saved-parameter data has survived each
time.  Apparently, picotool and the bootloader are smart enough
to do a selective erase of only the amount of area needed for
the new version of the app code.

Oh... possible hint for Linux users.  If you're planning to use
the bootloader mass-storage "copy a UF2 image to the device to
re-flash it", you may need to take steps to ensure that the
blocks in the image are actually written to the device in the
same order they're present in the image file.  This isn't
necessarily guaranteed to Linux due to the presence of the
general-purpose block cache and I/O scheduler... the file
blocks might be "pushed" over USB in an arbitrary order.
I've had inconsistent results just doing the simple "mount,
drag-and-drop" process using the desktop file manager.

Possible workaround 1: manually mount the device on a filesystem,
using the "-o sync" option, then drag-and-drop.

Possible workaround 2: mount, then
   dd if=foo.uf2 of=/mnt/foo.uf2 oconv=direct
to bypass the cache.

Back to comp.sys.raspberry-pi | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

RP2040 reset idea john larkin <JL@gct.com> - 2024-09-16 19:58 -0700
  Re: RP2040 reset idea Sylvia Else <sylvia@email.invalid> - 2024-09-17 12:16 +0800
    Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-17 07:10 -0700
  Re: RP2040 reset idea Arie de Muijnck <noreply@ademu.nl> - 2024-09-17 10:49 +0200
    Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-17 07:15 -0700
      Re: RP2040 reset idea Arie de Muijnck <noreply@ademu.nl> - 2024-09-17 17:39 +0200
  Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-17 11:07 +0100
    Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-17 07:20 -0700
    Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-17 09:09 -0700
      Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-17 17:21 +0100
        Re: RP2040 reset idea john larkin <jl@650pot.com> - 2024-09-17 15:33 -0700
          Re: RP2040 reset idea john larkin <jl@650pot.com> - 2024-09-18 12:56 -0700
            Re: RP2040 reset idea Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-19 02:45 +0000
              Re: RP2040 reset idea John R Walliker <jrwalliker@gmail.com> - 2024-09-19 10:02 +0100
          Re: RP2040 reset idea Lasse Langwadt <llc@fonz.dk> - 2024-09-20 00:09 +0200
            Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-20 09:20 +0100
              Re: RP2040 reset idea Theo <theom+news@chiark.greenend.org.uk> - 2024-09-20 11:30 +0100
                Re: RP2040 reset idea john larkin <jl@650pot.com> - 2024-09-20 11:00 -0700
                Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-21 09:12 +0100
                Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-21 08:08 -0700
                Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-21 19:29 +0100
                Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-21 12:43 -0700
                Re: RP2040 reset idea Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2024-09-21 19:50 +0000
                Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-21 12:56 -0700
                Re: RP2040 reset idea Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2024-09-21 20:46 +0000
                Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-21 16:11 -0700
                Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-22 09:33 +0100
                Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-22 08:28 -0700
                Re: RP2040 reset idea druck <news@druck.org.uk> - 2024-09-23 11:52 +0100
                Re: RP2040 reset idea Bob Martin <bob.martin@excite.com> - 2024-09-24 04:40 +0000
                Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-22 09:32 +0100
                Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-22 10:46 -0700
                Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-22 09:30 +0100
                Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-22 10:51 -0700
                Re: RP2040 reset idea dplatt@coop.radagast.org (Dave Platt) - 2024-09-21 20:08 -0700
                Re: RP2040 reset idea The Natural Philosopher <tnp@invalid.invalid> - 2024-09-22 09:37 +0100
  Re: RP2040 reset idea Theo <theom+news@chiark.greenend.org.uk> - 2024-09-17 16:42 +0100
    Re: RP2040 reset idea john larkin <JL@gct.com> - 2024-09-17 19:02 -0700

csiph-web