You are here

PSoC 4 Running out of ROM with small program? | Cypress Semiconductor

PSoC 4 Running out of ROM with small program?

Summary: 4 Replies, Latest post by hli on 21 Oct 2013 09:18 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
bkish's picture
1 post

What I am trying to do:

I am trying to make an autonomus car that can do object avoidance by using 2 sonars. I am trying to read from TWO HC-SR04 Sonar Sensors using a Mux to switch between them. I also need to control two motors with a H-bridge. 1 of the motors needs to have controlable speed (PWM). I also would like to have UART communication to a terminal so I can see feedback from the PSoC 4 about its current status.

The Problem:

Before I have even really started to write the program, I am getting a ROM overflow error. I am supprised since my code is fairly small at the moment and I am a little confused by this. I do not think my program is very big and I am confused why I am getting an overflow error?

A few questions:

I know there is ROM and SRAM, but I get confused on where the program is stored. What is each used for?

How much ROM does the PSoC 4 Have?

How can I see how much ROM / SRAM my code/internal wiring is taking?

How can I resolve this issue?

NOTE: I have attached the project to this post.

user_1377889's picture
10803 posts

Good news! When you update to Creator 3.0 latest version all will fit and compile fine. My build of your project resulted in:

Flash used: 6408 of 32768 bytes (19,6%).

SRAM used: 1676 of 4096 bytes (40,9%).

--------------- Build Succeeded: 10/21/2013 15:06:48 ---------------


Here you can see that the program area availlable (Flash or ROM) is 32k and the SRAM's size is 16k where your variables are stored. When you look at the "Output" tab in greator (Bottom of window) after a successful compile you'll see the amount of sram and flash used. Your error was generated by some old libraries for sprintf() which have been corrected lately.



user_14586677's picture
7648 posts

Generally speaking ROM is used for program and fixed vairable info,

like meassge strings, presets, etc..


RAM mainly used for variables that change as a result of computation.


I compiled your project under Creator 3.0 and it compiled fine with

following results -


Flash used: 6408 of 32768 bytes (19.6 %).

SRAM used: 1676 of 4096 bytes (40.9 %).







user_1377889's picture
10803 posts


Great! Makes me believe that computers might really be deterministic when we both getting the same results!



user_78878863's picture
2759 posts

Using sprintf() on Creator versions before 3.0 would include, automatically, the whole floating-point library. This takes too much flash ROM for the PSoC4. With creator 3.0, the new 'newlib-nano' is used, where a) the FP stuff is optional and b) should need less ROM anyway.

Log in to post new comments.