• Re: RP2040 reset idea

    From john larkin@21:1/5 to john larkin on Wed Sep 18 12:56:44 2024
    XPost: sci.electronics.design

    On Tue, 17 Sep 2024 15:33:14 -0700, john larkin <jl@650pot.com> wrote:

    On Tue, 17 Sep 2024 17:21:36 +0100, The Natural Philosopher ><tnp@invalid.invalid> wrote:

    On 17/09/2024 17:09, john larkin wrote:
    On Tue, 17 Sep 2024 11:07:17 +0100, The Natural Philosopher
    <tnp@invalid.invalid> wrote:

    On 17/09/2024 03:58, john larkin wrote:
    The RP2040 has a cool mode where it can be made to boot up with the
    USB port looking like a memory stick. That's great for software
    installs or upgrades. The Pico board has a BOOT button on the board; >>>>> if the pico is powered up with the button pushed, it goes into that
    boot mode.

    But if I have a product (actually a family of products) in a nice
    aluminum box, a user would have to remove the top cover, remove all
    power sources (there can be three), and hold the button down while
    reconnecting power.

    Some of my customers also want to lock a box such that it's impossible >>>>> to write to any nonvolatile memory while it's in a secure area.

    So here's an idea: a small hole in the box allows a toothpick or a
    paper clip to push a button. A short push is a regular reset. A long >>>>> push is a memory-stick mode boot. We can have a rotary switch LOCK
    hole too.

    Thats' what my PICO powered thermostats have. For the onboard button though
    Resetting is done by pulling the power.

    The point is that if you do power up with the button pressed, you wipe >>>> the entire FLASH RAM I think.


    My Pi guy verifies that entering boot mode doesn't change the contents
    of flash. Power cycle and things run like before.

    You had me worried!


    Really?

    I guess whenever I entered that mode it was to download fresh code...

    It looks like a USB memory stick. You can delete or add files if you
    want.

    It boots CPU 0 (the one we call Alice) from a file with the extension
    .UL2

    Why .UL2 one wonders.

    We'll put a bunch of files into the flash. Code for Bob, the 2nd CPU.
    An FPGA bitstream file. A prototype calibration table. A README file
    to explain everything in plain English.


    Update:

    The Pico only allows one file to be saved to the flash using USB
    memory-stick mode.

    If you copy a bunch of files into the flash, Windows will lie about
    what's there, but there is really only one. If you disconnect the USB
    cable and reconnect, Windows will show the one file.

    The Pi tools support packing a bunch of things into that one file,
    including the executable for Alice, namely CPU0. Alice takes over and
    loads Bob, CPU1, and can access other components of the big file.

    Power cycling, normal or into USB memory stick mode, does not wipe
    that big file.

    There's no simple way to examine the components of the big file, other
    than to ask Alice. Alice knows.

    All that is based on experiment.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to john larkin on Thu Sep 19 02:45:34 2024
    XPost: sci.electronics.design

    On Wed, 18 Sep 2024 12:56:44 -0700, john larkin wrote:

    If you copy a bunch of files into the flash, Windows will lie about
    what's there, but there is really only one. If you disconnect the USB
    cable and reconnect, Windows will show the one file.

    What if you try it from Linux?

    Unlike Windows, Linux is less prone to lie about things.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lasse Langwadt@21:1/5 to john larkin on Fri Sep 20 00:09:43 2024
    XPost: sci.electronics.design

    On 9/18/24 00:33, john larkin wrote:
    On Tue, 17 Sep 2024 17:21:36 +0100, The Natural Philosopher <tnp@invalid.invalid> wrote:

    On 17/09/2024 17:09, john larkin wrote:
    On Tue, 17 Sep 2024 11:07:17 +0100, The Natural Philosopher
    <tnp@invalid.invalid> wrote:

    On 17/09/2024 03:58, john larkin wrote:
    The RP2040 has a cool mode where it can be made to boot up with the
    USB port looking like a memory stick. That's great for software
    installs or upgrades. The Pico board has a BOOT button on the board; >>>>> if the pico is powered up with the button pushed, it goes into that
    boot mode.

    But if I have a product (actually a family of products) in a nice
    aluminum box, a user would have to remove the top cover, remove all
    power sources (there can be three), and hold the button down while
    reconnecting power.

    Some of my customers also want to lock a box such that it's impossible >>>>> to write to any nonvolatile memory while it's in a secure area.

    So here's an idea: a small hole in the box allows a toothpick or a
    paper clip to push a button. A short push is a regular reset. A long >>>>> push is a memory-stick mode boot. We can have a rotary switch LOCK
    hole too.

    Thats' what my PICO powered thermostats have. For the onboard button though
    Resetting is done by pulling the power.

    The point is that if you do power up with the button pressed, you wipe >>>> the entire FLASH RAM I think.


    My Pi guy verifies that entering boot mode doesn't change the contents
    of flash. Power cycle and things run like before.

    You had me worried!


    Really?

    I guess whenever I entered that mode it was to download fresh code...

    It looks like a USB memory stick. You can delete or add files if you
    want.

    It boots CPU 0 (the one we call Alice) from a file with the extension
    .UL2

    Why .UL2 one wonders.

    We'll put a bunch of files into the flash. Code for Bob, the 2nd CPU.
    An FPGA bitstream file. A prototype calibration table. A README file
    to explain everything in plain English.

    sure it's not UF2?

    https://github.com/microsoft/uf2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Lasse Langwadt on Fri Sep 20 09:20:24 2024
    XPost: sci.electronics.design

    On 19/09/2024 23:09, Lasse Langwadt wrote:
    On 9/18/24 00:33, john larkin wrote:

    It looks like a USB memory stick. You can delete or add files if you
    want.

    It boots CPU 0 (the one we call Alice) from a file with the extension
    .UL2

    Why   .UL2   one wonders.

    We'll put a bunch of files into the flash. Code for Bob, the 2nd CPU.
    An FPGA bitstream file. A prototype calibration table. A README file
    to explain everything in plain English.

    sure it's not UF2?

    https://github.com/microsoft/uf2


    Definitely uf2 here.

    And no, you cannot 'delete or add files' to it.
    The action of pretending to download a uf2 file into what appears to be
    an empty drive, erases everything on it and programs the flash.

    There are no visible files to delete.


    --
    Those who want slavery should have the grace to name it by its proper
    name. They must face the full meaning of that which they are advocating
    or condoning; the full, exact, specific meaning of collectivism, of its
    logical implications, of the principles upon which it is based, and of
    the ultimate consequences to which these principles will lead. They must
    face it, then decide whether this is what they want or not.

    Ayn Rand.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Theo@21:1/5 to The Natural Philosopher on Fri Sep 20 11:30:13 2024
    XPost: sci.electronics.design

    In comp.sys.raspberry-pi The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 19/09/2024 23:09, Lasse Langwadt wrote:
    On 9/18/24 00:33, john larkin wrote:

    It looks like a USB memory stick. You can delete or add files if you
    want.

    It boots CPU 0 (the one we call Alice) from a file with the extension
    .UL2

    Why   .UL2   one wonders.

    We'll put a bunch of files into the flash. Code for Bob, the 2nd CPU.
    An FPGA bitstream file. A prototype calibration table. A README file
    to explain everything in plain English.

    sure it's not UF2?

    https://github.com/microsoft/uf2


    Definitely uf2 here.

    And no, you cannot 'delete or add files' to it.
    The action of pretending to download a uf2 file into what appears to be
    an empty drive, erases everything on it and programs the flash.

    There are no visible files to delete.

    Neat. So basically you throw some files at it, which causes a series of
    block writes. UF2 picks out specially tagged block writes and uses that to program the flash. It doesn't actually care what other stuff is written to
    the flash as it ignores all of that, so it doesn't care about all the FAT
    stuff or whatever junk your OS decides to put on there.

    Means you can write any kind of files to it and it'll only pay attention to
    the specific tagged blocks. If the OS is happy to cache the medium (as many do) you could maybe even reformat it as some other filesystem like NTFS and
    it would still handle writing the UF2 file correctly.

    Theo

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From john larkin@21:1/5 to theom+news@chiark.greenend.org.uk on Fri Sep 20 11:00:00 2024
    XPost: sci.electronics.design

    On 20 Sep 2024 11:30:13 +0100 (BST), Theo
    <theom+news@chiark.greenend.org.uk> wrote:

    In comp.sys.raspberry-pi The Natural Philosopher <tnp@invalid.invalid> wrote: >> On 19/09/2024 23:09, Lasse Langwadt wrote:
    On 9/18/24 00:33, john larkin wrote:

    It looks like a USB memory stick. You can delete or add files if you
    want.

    It boots CPU 0 (the one we call Alice) from a file with the extension
    .UL2

    Whyáá .UL2áá one wonders.

    We'll put a bunch of files into the flash. Code for Bob, the 2nd CPU.
    An FPGA bitstream file. A prototype calibration table. A README file
    to explain everything in plain English.

    sure it's not UF2?

    https://github.com/microsoft/uf2


    Definitely uf2 here.

    And no, you cannot 'delete or add files' to it.
    The action of pretending to download a uf2 file into what appears to be
    an empty drive, erases everything on it and programs the flash.

    There are no visible files to delete.

    Neat. So basically you throw some files at it, which causes a series of >block writes. UF2 picks out specially tagged block writes and uses that to >program the flash. It doesn't actually care what other stuff is written to >the flash as it ignores all of that, so it doesn't care about all the FAT >stuff or whatever junk your OS decides to put on there.

    Means you can write any kind of files to it and it'll only pay attention to >the specific tagged blocks. If the OS is happy to cache the medium (as many >do) you could maybe even reformat it as some other filesystem like NTFS and >it would still handle writing the UF2 file correctly.

    Theo

    My Pi guy says that you can only write one file, and the act of
    writing that file wipes anything that was there before. So the flash
    probably doesn't have a file structure, and the USB memory-stick write
    is, well, a sort of cheap trick.

    That's workable, if inelegant. We can pack everything we need into
    that one big file and users can upgrade box code in the field pretty
    easily.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to john larkin on Sat Sep 21 09:12:06 2024
    XPost: sci.electronics.design

    On 20/09/2024 19:00, john larkin wrote:
    On 20 Sep 2024 11:30:13 +0100 (BST), Theo
    <theom+news@chiark.greenend.org.uk> wrote:

    In comp.sys.raspberry-pi The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 19/09/2024 23:09, Lasse Langwadt wrote:
    On 9/18/24 00:33, john larkin wrote:

    It looks like a USB memory stick. You can delete or add files if you >>>>> want.

    It boots CPU 0 (the one we call Alice) from a file with the extension >>>>> .UL2

    Why   .UL2   one wonders.

    We'll put a bunch of files into the flash. Code for Bob, the 2nd CPU. >>>>> An FPGA bitstream file. A prototype calibration table. A README file >>>>> to explain everything in plain English.

    sure it's not UF2?

    https://github.com/microsoft/uf2


    Definitely uf2 here.

    And no, you cannot 'delete or add files' to it.
    The action of pretending to download a uf2 file into what appears to be
    an empty drive, erases everything on it and programs the flash.

    There are no visible files to delete.

    Neat. So basically you throw some files at it, which causes a series of
    block writes. UF2 picks out specially tagged block writes and uses that to >> program the flash. It doesn't actually care what other stuff is written to >> the flash as it ignores all of that, so it doesn't care about all the FAT
    stuff or whatever junk your OS decides to put on there.

    Means you can write any kind of files to it and it'll only pay attention to >> the specific tagged blocks. If the OS is happy to cache the medium (as many >> do) you could maybe even reformat it as some other filesystem like NTFS and >> it would still handle writing the UF2 file correctly.

    Theo

    My Pi guy says that you can only write one file, and the act of
    writing that file wipes anything that was there before. So the flash
    probably doesn't have a file structure, and the USB memory-stick write
    is, well, a sort of cheap trick.

    That's workable, if inelegant. We can pack everything we need into
    that one big file and users can upgrade box code in the field pretty
    easily.


    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.
    And it gets wiped when new code is uploaded


    It is an area I will have to tackle for one project tho.


    --
    Microsoft : the best reason to go to Linux that ever existed.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)