|
Forum Index : Microcontroller and PC projects : How about this for a Christmas surprise?
| Author | Message | ||||
| karlelch Senior Member Joined: 30/10/2014 Location: GermanyPosts: 287 |
With your new version, the issue seems to be gone (see above). I was only surprised that nothing helped, not even nuking, except writing an other firmware version. Maybe I don't have the latest nuke? I am using a RP2350B w/ 6MB PSRAM. |
||||
| karlelch Senior Member Joined: 30/10/2014 Location: GermanyPosts: 287 |
Soon, MMBasic will be fully OO ... ![]() Edited 2025-12-23 02:01 by karlelch |
||||
| karlelch Senior Member Joined: 30/10/2014 Location: GermanyPosts: 287 |
This looks like a small issue: > list Option Base 0 Option Explicit Type TMotor vel As Float velStep As Float newVel As Float End Type Type TRobot motor(1) As TMotor nSteps As Integer End Type Dim self As TRobot Struct Clear self self.nSteps = 0 Struct print self self.nSteps = self.nSteps +1 Struct print self Inc self.nSteps, 1 > Produces a syntax error: TROBOT: .MOTOR = TMOTOR: .VEL = 0 .VELSTEP = 0 .NEWVEL = 0 .NSTEPS = 0 TROBOT: .MOTOR = TMOTOR: .VEL = 0 .VELSTEP = 0 .NEWVEL = 0 .NSTEPS = 1 [23] Inc self.nSteps, 1 Error : Invalid syntax > |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5544 |
Slowly but unaviodable all languages merge. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10736 |
Attached is a complete set of the RP2350 firmware with structures implemented. This also fixes the "INC" bug and a number of similar issues. Also it makes changes to avoid pre-processor errors looping without clearing the program. PicoMiteRP2350V6.01.00EXP.zip NB: structures will not be implemented for the RP2040 - too much code. Edited 2025-12-23 03:32 by matherp |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 513 |
Wow! Thanks, Santa! (Peter) |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 357 |
Peter, there seems to be a strange memory leak. Just after rebooting the pico the heap seems to get smaller and smaller without any program have been running. PSRAM or not does not make any difference, the heap shrinks. Example: -------------------- PicoMiteHDMI MMBasic RP2350B Edition V6.01.00EXP Copyright 2011-2025 Geoff Graham Copyright 2016-2025 Peter Mather Total of 6 Mbytes PSRAM available > print mm.info(heap) 6446336 > print mm.info(heap) 6434048 > print mm.info(heap) 6421760 > print mm.info(heap) 6409472 > print mm.info(heap) 6397184 > print mm.info(heap) 6384896 > print mm.info(heap) 6372608 > print mm.info(heap) 6351360 > print mm.info(heap) 6339072 > print mm.info(heap) 6326784 > Edit: when using no PSRAM I relatively fast get into the following state, looping with Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point Error : Not enough Heap memory [15] Type Point only reset clears that Edit2: the test program has to be loaded, but no need to run it once. Same behaviour after power cycling. Gerald Edited 2025-12-23 04:08 by ville56 73 de OE1HGA, Gerald |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10736 |
UPDATE I understand the issue, the leak only happens if you execute multiple commands at the command prompt. If you run the program and then type mm.info(heap) afterwards you will always get the same value as RUN clear memory whereas commands at the prompt don't. I'll put some code in not to re-allocate memory if at the command prompt Check for something in the library etc. nuke the flash. Doesn't do if for me. List all options too so I can see if I can replicate Edited 2025-12-23 04:23 by matherp |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10736 |
Ignore Edited 2025-12-23 04:39 by matherp |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 357 |
what I've done: - nuked flash, loaded V6.01.00EXP, mm.info(heap) is stable - loaded your test program, ran it once, mm.Info(heap) decreases - resetting pico, prog loaded but not run, mm.Info(heap) decreases -typed NEW, mm.info(heap) is stable but a few seconds later entered a boot-loop. After abt 5 reboot in the loop the > prompt came up and heap is stable again. - copying test program to A: drive via MMCC, LOAD test-program, heap shrinks. > option list PicoMite MMBasic RP2350B V6.01.00EXP OPTION FLASH SIZE 16777216 OPTION COLOURCODE ON OPTION PICO OFF OPTION CPUSPEED (KHz) 200000 heap with prog just loaded: ----------------------------------------------- PicoMite MMBasic RP2350B V6.01.00EXP Copyright 2011-2025 Geoff Graham Copyright 2016-2025 Peter Mather > print mm.info(heap) 302336 > print mm.info(heap) 290048 > print mm.info(heap) 277760 > print mm.info(heap) 265472 > print mm.info(heap) 253184 > Edit: Just loading this short program already shows the heap issue. Option Explicit Option Default None Type Point x As INTEGER y As INTEGER End Type edit2: after NEW writing in the editor type point end type saving with F1 is sufficient to start shrinking the heap Edited 2025-12-23 05:29 by ville56 73 de OE1HGA, Gerald |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10736 |
types/structs use heap for their data structures so you will see heap usage even if you define a type but don't use it. This is better than a static allocation because, for a user who doesn't use TYPE, no memory is lost. The bug was that it re-allocated that memory every time a command was run at the command prompt (not in a program). This should be fixed in the attached. PicoMiteRP2350V6.01.00EXP.zip Edited 2025-12-23 05:40 by matherp |
||||
| ville56 Guru Joined: 08/06/2022 Location: AustriaPosts: 357 |
Thank you Peter, heap is now stable. ![]() 73 de OE1HGA, Gerald |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 166 |
very cool. i must hurry up to get my picomite computer from jlcp... |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6399 |
It hasn't broken any of the programs I have tested with so that is good. Most of my deployed 'mites will not benefit but structures are something I have wished for many times. There are a few challenges with highlighting in MMEdit but indenting and code folding works nicely with minor modification. Good work Santa! VK7JH MMedit |
||||
| thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4334 |
Santa Claude & Zwarte Piet ? MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
| Amnesie Guru Joined: 30/06/2020 Location: GermanyPosts: 736 |
Hello Peter, There is a bug with play mp3 again (in latest version and offical release). When executed it does a reboot + strange behavior. HDMI /ps2 Version tested from: PicoMiteRP2350V6.01.00EXP.zip Edited 2025-12-23 05:40 by matherp EDIT: There is ALSO a problem in the latest offical release, please see the attached video, since the problem with play mp3 isn't constant! DROPBOX link: play mp3 problem video I can confirm that everything works with version: V6.01.00RC25 PicobMiteV6.01.00RC25.zip Greetings Daniel Edited 2025-12-23 10:23 by Amnesie |
||||
| TimD Newbie Joined: 23/02/2021 Location: United KingdomPosts: 32 |
Oh my days, this is excellent - thank you! Any chance it can eventually be ported to the CMM2? Kind regards and Merry Christmas, Tim. |
||||
| robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2474 |
hi Peter, all very PASCAL like have just scanned through the thread, it looks like you haven't yet implemented anything like the pascal WITH statement: Type Person age As INTEGER height As FLOAT name As STRING End Type Dim person1 As Person WITH person1 DO age = 42 height = 1.85 name = "John" END WITH (the use of DO in the context of mmbasic is probably superfluous) the use of WITH saves on a great deal of duplicated typing and hence consumed flash program space. cheers, rob :-) |
||||
| toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 513 |
all very PASCAL like have just scanned through the thread, it looks like you haven't yet implemented anything like the pascal WITH statement: Type Person age As INTEGER height As FLOAT name As STRING End Type Dim person1 As Person WITH person1 DO age = 42 height = 1.85 name = "John" END WITH (the use of DO in the context of mmbasic is probably superfluous) the use of WITH saves on a great deal of duplicated typing and hence consumed flash program space. cheers, rob :-) It looks like Peter was going for Microsoft BASIC compatibility. If so, then in that case, you'd type Type Person age As INTEGER height As FLOAT name As STRING End Type Dim person1 As Person person1.age = 42 person1.height = 1.85 person1.name = "John" |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |