Is there any way to find out how much ram and ROM I am using? I have gone through the compiler messages and I didn't see any stats on this.
Thanks,
Chad
RP2040 ram and rom usage?
-
- Posts: 63
- http://meble-kuchenne.info.pl
- Joined: Fri Dec 18, 2020 1:15 pm
- Has thanked: 24 times
-
- Valued Contributor
- Posts: 989
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 106 times
- Been thanked: 517 times
Re: RP2040 ram and rom usage?
It's probably less important to know on the Pi.
You can use something like htop to view some stats. In a program you can use sysinfo (in a C block) to get some details.
With mega or gigabytes of ram (and virtual memory) it's unlikely you'll hit any hard limits from a FC program - and the compiler might struggle to calculate ram usage - there might be dynamically allocated memory (using new - file buffers for example)
Martin
You can use something like htop to view some stats. In a program you can use sysinfo (in a C block) to get some details.
With mega or gigabytes of ram (and virtual memory) it's unlikely you'll hit any hard limits from a FC program - and the compiler might struggle to calculate ram usage - there might be dynamically allocated memory (using new - file buffers for example)
Martin
-
- Valued Contributor
- Posts: 162
- Joined: Wed Dec 02, 2020 7:28 pm
- Has thanked: 68 times
- Been thanked: 58 times
Re: RP2040 ram and rom usage?
Hmm, the RP2040 has just 264K RAM and up to 16MB flash.
Please don’t confuse the microcontroller created by the foundation with the (Linux) mini computer created by them.
Please don’t confuse the microcontroller created by the foundation with the (Linux) mini computer created by them.
-
- Valued Contributor
- Posts: 989
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 106 times
- Been thanked: 517 times
Re: RP2040 ram and rom usage?
I had, indeed, assumed it was a Raspberry Pi variant. Still - I think the argument stands for 264K of RAM and 16MB of flash - that's going to be one meaty flowchart
Does look an interesting bit of kit though...
Martin
Does look an interesting bit of kit though...
Martin
Re: RP2040 ram and rom usage?
Yeah, the one I am using has 2mb of flash and 264k of ram. I am going to be doing a bunch of display stuff and I don't have a good feel how much ram that is going to take, and I can't find anything in FC that will let me know. I am probably just missing it.
c
c
-
- Valued Contributor
- Posts: 1182
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 289 times
- Been thanked: 417 times
Re: RP2040 ram and rom usage?
Hi
I might be wrong but in all the official sites I've looked in the Pico is offered as Chad describes, with 2MB of Flash and 264Kb of RAM. I've not found anything obvious either to inform how much of the resources the chart is taking up. Guessing that's due to the 3rd party software used.
I see clones from the usual suspects are offered with up to 16MB of flash though, but even at 2MB that is still considerable resources.
I obtained my Pico free with a magazine (HackSpace I think) and it just sat there. I never bothered with it until FC made it a target and even then it wasn't until Chad's initial post that I actually did anything about it, mainly to see if I too had any issues getting it to work. Since then however it is growing on me. I added headers and it sits within reach. If I need to quickly "do something" I can simply attach jumpers to say a module, plug it into the PC and off I go. Seems to compile quicker than an ESP.
A post elsewhere asked Matrix if the "W" would be supported as well. I'm now quite keen for that to happen too.
I'm sure many would debate the ESP32 v Pico(W) though......
Regards
I might be wrong but in all the official sites I've looked in the Pico is offered as Chad describes, with 2MB of Flash and 264Kb of RAM. I've not found anything obvious either to inform how much of the resources the chart is taking up. Guessing that's due to the 3rd party software used.
I see clones from the usual suspects are offered with up to 16MB of flash though, but even at 2MB that is still considerable resources.
I obtained my Pico free with a magazine (HackSpace I think) and it just sat there. I never bothered with it until FC made it a target and even then it wasn't until Chad's initial post that I actually did anything about it, mainly to see if I too had any issues getting it to work. Since then however it is growing on me. I added headers and it sits within reach. If I need to quickly "do something" I can simply attach jumpers to say a module, plug it into the PC and off I go. Seems to compile quicker than an ESP.
A post elsewhere asked Matrix if the "W" would be supported as well. I'm now quite keen for that to happen too.
I'm sure many would debate the ESP32 v Pico(W) though......
Regards
Re: RP2040 ram and rom usage?
Hi Chip, thanks again for looking at this for me. I ordered some picos from Amazon for cheap because I have a habit of collecting dev boards. I also got these during the chip shortage, and they were available and wanted to play with them.
I want to use a nice little 320 x240 display and ben is beefing up the display driver for it, and we are making progress. Went from 300ms to do a background fill to 88 ms. That's a big improvement!! Super happy about that. My actual FC program is going to be pretty simple, I am just worried about the ram that the display driver and the bitmap drawer is going to use.
I tried to use the internal PWM. I set it to have a 5k refresh rate and then tried to vary the duty cycle. I am planning on using this to control the brightness of the lcd display led backing ht. It's not working correct, but as I suck at programming, I don't know if it is an FC issue or a me issue... Anyway, I will address this later.
If you haven't yet, go to YouTube and search for rp 2040 'PIO'. Apparently, this chip has 8 independent little processors that can be programmed to do a wide range of neat things. Could be super handy and powerful. I noticed that FC implemented a “state machine” feature, but I have found very little on the forums about it, and the wiki is pretty thin on what good they are. If these can talk to the rp2040 state machines, it could add a ton of functionality to these chips. One of the uses on YouTube is to drive led strips. They set it up, so the PIO handled all the io, dma handled the data transfer and the CPU just updated color values and didn't have to do the heavy lifting of the bit timing.
One other thing, If you figure out how to use the second processor, let me know. I would love to shift all the display stuff to one processor and let the other handle the rest of the code. This sounds like it would be a good use for the PIO as well.
I am a hardware guy. I am pretty good with the electronics end of things, but I am not a programmer. That's why I am so interested in FC. I might be finally able to program widgets that I want to build and not have to rely on friends for code.
I am going to be going through the rp and some components and see if we can get the 2040 optimized.
Thanks,
c
I want to use a nice little 320 x240 display and ben is beefing up the display driver for it, and we are making progress. Went from 300ms to do a background fill to 88 ms. That's a big improvement!! Super happy about that. My actual FC program is going to be pretty simple, I am just worried about the ram that the display driver and the bitmap drawer is going to use.
I tried to use the internal PWM. I set it to have a 5k refresh rate and then tried to vary the duty cycle. I am planning on using this to control the brightness of the lcd display led backing ht. It's not working correct, but as I suck at programming, I don't know if it is an FC issue or a me issue... Anyway, I will address this later.
If you haven't yet, go to YouTube and search for rp 2040 'PIO'. Apparently, this chip has 8 independent little processors that can be programmed to do a wide range of neat things. Could be super handy and powerful. I noticed that FC implemented a “state machine” feature, but I have found very little on the forums about it, and the wiki is pretty thin on what good they are. If these can talk to the rp2040 state machines, it could add a ton of functionality to these chips. One of the uses on YouTube is to drive led strips. They set it up, so the PIO handled all the io, dma handled the data transfer and the CPU just updated color values and didn't have to do the heavy lifting of the bit timing.
One other thing, If you figure out how to use the second processor, let me know. I would love to shift all the display stuff to one processor and let the other handle the rest of the code. This sounds like it would be a good use for the PIO as well.
I am a hardware guy. I am pretty good with the electronics end of things, but I am not a programmer. That's why I am so interested in FC. I might be finally able to program widgets that I want to build and not have to rely on friends for code.
I am going to be going through the rp and some components and see if we can get the 2040 optimized.
Thanks,
c
-
- Valued Contributor
- Posts: 1182
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 289 times
- Been thanked: 417 times
Re: RP2040 ram and rom usage?
Hi
I would imagine you would need to be displaying a lot for it to be anywhere near a problem.
I did a simulation with one of the PWM channels running at 5KHz, having duty go from 0-100% without issue. I'll try on hardware but not expecting much trouble. Setting the frequency at 5KHz means a rollover at 24999 so for a 50% duty cycle you would set it at ~12500 etc.
I'm guessing that to use multiple cores a fair bit of "C" would be required.
I'm not a programmer either, I'm a Flowcoder
Regards
I would imagine you would need to be displaying a lot for it to be anywhere near a problem.
I did a simulation with one of the PWM channels running at 5KHz, having duty go from 0-100% without issue. I'll try on hardware but not expecting much trouble. Setting the frequency at 5KHz means a rollover at 24999 so for a 50% duty cycle you would set it at ~12500 etc.
I'm guessing that to use multiple cores a fair bit of "C" would be required.
I'm not a programmer either, I'm a Flowcoder
Regards
-
- Valued Contributor
- Posts: 401
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 73 times
- Been thanked: 218 times
Re: RP2040 ram and rom usage?
There's an example or two of second core use on forum, can't recall where (and I'm not near PC at the moment).
Second core code goes in a separate macro, and gets invoked from a few lines of C in the main.
Second core code goes in a separate macro, and gets invoked from a few lines of C in the main.