Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pset_read'ing a slot which has uninitalized data crashes grid #17

Open
dndrks opened this issue Jan 28, 2025 · 3 comments
Open

pset_read'ing a slot which has uninitalized data crashes grid #17

dndrks opened this issue Jan 28, 2025 · 3 comments

Comments

@dndrks
Copy link
Member

dndrks commented Jan 28, 2025

steps to repro

  • execute pset_read(n) where n is a slot with no data yet saved to it

expected
no data is returned

experienced
grid freezes and is unresponsive to press + diii commands until hot-plugged

@tehn
Copy link
Member

tehn commented Jan 29, 2025

fixed in 250129

@tehn tehn closed this as completed Jan 29, 2025
@dndrks
Copy link
Member Author

dndrks commented Feb 1, 2025

hihi! still experiencing pset_read crashes with 250201.

test script:

print("hi!")
metro.new(function(x)
  if x == 1 then
    print("going to read a blank pset!")
  elseif x == 2 then
    print('reading PSET "10"')
    pset_read(10)
  elseif x == 3 then
    print("did we get here?")
  end
end, 600, 3)

of note, the 2nd pass's print command doesn't execute ahead of trying the pset_read(10)...
lmk if there's anything else i can provide!

@dndrks dndrks reopened this Feb 1, 2025
@tehn
Copy link
Member

tehn commented Feb 4, 2025

confirmed.

if you try to flash_read() on an uninitialized flash slot it will potentially try to return a huge long string with unpredictable results. if run from pset_read it will attempt to execute this and break.

i added a firmware fix to clear the flash area when uploading the firmware for the first time, which will be in the next release. however this won't fix devices that have an earlier beta installed.

to fix this in beta, run:

for i=1,256 do flash_clear(i) end

or better yet, i'm considering adding some metadata to the pset system so it is aware of which flash slots have been written, hence which are safe to load.

before that happens, you can roll your own. (i did this in another script, just a table that gets stored to slot 1 with metadata of which psets are legit)

i'm going to leave this open until it's truly fixed, not just partial

@tehn tehn changed the title pset_read'ing a slot which has no data crashes grid pset_read'ing a slot which has uninitalized data crashes grid Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants