RP2040 ram and rom usage?

For general Flowcode discussion that does not belong in the other sections.
Chadb
Posts: 63
http://meble-kuchenne.info.pl
Joined: Fri Dec 18, 2020 1:15 pm
Has thanked: 24 times

Flowcode v10 RP2040 ram and rom usage?

Post by Chadb »

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

mnfisher
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?

Post by mnfisher »

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

kersing
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?

Post by kersing »

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.

mnfisher
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?

Post by mnfisher »

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

kersing
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?

Post by kersing »

Up to 16MB depending on what the manufacturer of the module fitted. I think most will have 2MB.

Chadb
Posts: 63
Joined: Fri Dec 18, 2020 1:15 pm
Has thanked: 24 times

Re: RP2040 ram and rom usage?

Post by Chadb »

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

chipfryer27
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?

Post by chipfryer27 »

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

Chadb
Posts: 63
Joined: Fri Dec 18, 2020 1:15 pm
Has thanked: 24 times

Re: RP2040 ram and rom usage?

Post by Chadb »

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

chipfryer27
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?

Post by chipfryer27 »

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

LeighM
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?

Post by LeighM »

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.

Post Reply