1 2 Previous Next 22 Replies Latest reply on Jul 8, 2020 10:59 AM by DeWa_4681626

    PSoC 62 Application flash size

    DeWa_4681626

      Hi
      I am building my application in Mbed-OS 5.15.1 on PSoC 62. According to the datasheet, application flash has a capacity of 1MB. Before I added WiFi to my application, the text section of my application (contains other features such as BLE) was about 442KB, and it ran fine. However, after adding WiFi feature, compilation would fail with the following message

       

      region `flash` overflowed by 26716 bytes.

       

      However, as I reviewed the linker file, 1MB is allocated for `flash` section. I understand that application is shared between two cores. The code for CM0+ is about 6KB, and my application size seems to be below the limit as well. Thus, I am quite puzzled why compiler thinks there is an overflow. Really appreciate if anyone can help pin point the issue. Is there something missing? Or where I can look into to resolve the issue?

       

      Thanks,

      Dennis

        • 1. Re: PSoC 62 Application flash size
          WiWi_4702256

          Dennis,

           

          I am working on a dual program. Maybe you could compare mine against yours and it will give you some insight.

           

          I thought that you might try letting  the system decide stack size using the dummy variable... Just a guess on my part.

           

          Untitled.gif

           

           

          William

          • 2. Re: PSoC 62 Application flash size
            DeWa_4681626

            Hi William,
            Thanks for the reply and the suggestion. I modified the stack section based on your linker script. Unfortunately, I still see the flash section overflow compilation error...

             

            In your dual program, are you able to use more than 512KB of the application flash area?

            • 3. Re: PSoC 62 Application flash size
              WiWi_4702256

              Dennis,

               

              I am used to looking at the map and it tells me start finish and used...

              I dont see that...

              The best I have is memory configuration and the code size and sram after a successful build. If you want me too I will send the map of the cm0 and cm4...

               

              Williamsmemoryuse.gif

              • 4. Re: PSoC 62 Application flash size
                DeWa_4681626

                Hi William,
                Really appreciate the help! The previous linker script didn't contain the memory map. If I may borrow your expertise, would you mind helping me diagnose what might go wrong in the linker script or memory map?

                 

                Below is the memory map configuration when the compiler thinks there is an overflow.
                In PSoC 62, the actual application flash is from 0x10000000 to 0x10100000. cm0p_image + flash should fit into this region, but I am quite puzzled why flash section is allocated with 0xfe000.
                cm0p_image contains small piece of code to boot CM4 from CM0+. It is about 6KB.
                My WiFi portion is about 88KB (the number is obtained by removing other features and get the difference between compilation with WiFi feature and compilation without WiFi feature). So this 88KB increment should fit with my rest of the application + cm0p_image, which is about 442KB + 6KB, when I put the code together. My WiFi feature is independent to other features.
                Thus, I am quite puzzled why flash section is allocated with 0xfe000.

                memcfg.PNG

                Thanks,
                Dennis

                • 5. Re: PSoC 62 Application flash size
                  WiWi_4702256

                  Dennis,

                   

                  I assume since you are using mbed, you are using modustoolbox correct? So if you running mbed, how did you and where did you get the wifi from? You said you added wifi and ran into problems correct?

                  Also, had you made all your mods to the linker file before or after or both once the addition of wifi.

                  So if you could describe you environment to me maybe I can recreate it.

                  Or you could bundle the software and send it unless you are in my situation and cannot send software since you dont own it and under a 5 year NDA agreement.

                   

                  Thanks,

                  William

                  • 6. Re: PSoC 62 Application flash size
                    WiWi_4702256

                    MBED_ROM_START = 0x10000000

                    FLASH_CM0P_SIZE = 0x2000

                    MBED_APP_START = 10002000

                    MBED_ROM_SIZE = 0x00100000

                    MBED_APP_SIZE = MBED_ROM_SIZE  - FLASH_CM0P_SIZE

                    MBED_APP_SIZE = 0x00100000 - 0x2000 = FE000

                    • 7. Re: PSoC 62 Application flash size
                      WiWi_4702256

                      According to the attached documentation:

                      Application Size is - 0x10000000 - 0x100FFFFF = FFFFF

                       

                      Your application is size is:

                      MBED_RAM_SIZE = 0x00045800

                      +FLASH_CM0P_SIZE=0x2000

                      +MBED_APP_SIZE=0xFE000

                                                                                                   = 0x145800

                      Go back to it working -  save the map

                      Then add your wifi - save the map

                      It should give you some clues...

                       

                      Are somehow send what you can so I can recreate your issue...

                       

                      By suspision is that there is a zero to many in your make file, recheck your build files

                      • 9. Re: PSoC 62 Application flash size
                        DeWa_4681626

                        Hi William,
                        Thanks a lot for the help!

                        I assume since you are using mbed, you are using modustoolbox correct? So if you running mbed, how did you and where did you get the wifi from? You said you added wifi and ran into problems correct?

                        I am using mbed-os to develop my application, so the wifi is directly from mbed API. If I use wifi alone (and remove other features), compile can pass and wifi is working fine.

                        Also, had you made all your mods to the linker file before or after or both once the addition of wifi.

                        The mods you referred to were the stack size modifications in linker file, right? I did that and compiled it with the addition of wifi, and still ran into the overflow compilation error.


                        Nevertheless, reading from your other comments, I think you have nailed down the issue. "MBED_RAM_SIZE = 0x00045800" is quite a big area.
                        This linker file was taken directly from mbed (they provided support for PSoC 62).

                        I have limited knowledge on the linker script, so please correct me if I misunderstood, so MBED_RAM_SIZE is the size of the "ram" area which is used by .ramVectors, .data, .noinit, .bss, and .heap sections. Is it ok to change this size? What would be the recommended size for "ram"?
                        And by letting the system decide the stack size we can use smaller MBED_RAM_SIZE? 

                         

                        Thanks,
                        Dennis

                        • 10. Re: PSoC 62 Application flash size
                          WiWi_4702256

                          Which kit do you have Dennis?

                          PSoC 6 WiFi-BT Prototyping Kit

                          PSoC 6 WiFi-BT Pioneer Kit

                          or...

                           

                          1. The reason I ask is you may be running into the same situation I ran into... AnyCloud_OTA_MQTT on PSOC 6 WIFI-BT Pioneer Kit

                           

                          KitIssue.gif

                          Lets just eliminate that possibility ok...

                           

                          2. Then could you tell me what you are trying to accomplish with your program development (IoT, etc)?

                          3. Then could you tell me what development platform you are using WICED, PSOC Creator, or Modustoolbox or a combination of one or more of those IDE's?

                          4. Why did you choose to use mbed os? The reason I asked that is because I tried mbed in the beginning and just did not seem to be the right choice. FreeRTOS seems to be the goto OS in AWS and Cypress it seems to me...

                           

                          Well... I did some checking and found some interesting tidbits... I searched on "mbed_ram_start and mbed_ram_size psoc 62" and found this... Have you seen this? It may be what your dealing with...

                           

                          maybeissue.gif

                           

                          Plus there is this fellow named Alan Hawse with IOT Expert, I've seen him on some Cypress Training Videos... So I believe he is with Cypress... Anyway I found a page for PSoC mbed instructions that may be used to compare how he set up the files the about image speaks about...

                           

                          Alan_H.gif

                           

                          Also since you are using mbed, then you can use the mbed command you will see on the image to download his examples for comparison and possibly to use in your application...

                           

                          Keep me posted...

                           

                          William

                          • 11. Re: PSoC 62 Application flash size
                            WiWi_4702256

                            So just to make sure, the one sentence in the image is "the CMSIS DFP Pack has no information about RAM split between CM4 & CM0+ applications"... I bet that is the issue... I hope it is at least...

                            • 12. Re: PSoC 62 Application flash size
                              DeWa_4681626

                              Hi William,

                              Really appreciate for looking into these in great details. Regarding your questions

                               

                              1. I am using PSoC 6 WiFi-BT Pioneer Kit
                              2. I am building a wearable device with sensors on top of it. It is getting the sensor data frequently, but it only accesses the WiFi when it needs to upload massive data to the server.
                              3. I am using Mbed Studio IDE.
                              4. We switch to PSoC 62 from previous development and RTOS is one of the requirements for the firmware. So far Mbed API's seem to be well supported, we haven't ran into serious issues.
                                May I know what kind of issues you ran into with Mbed? Maybe we haven't encountered it yet...

                                Thanks for sharing the commit about mbed_ram_start and mbed_ram_size. After reviewing their comments and my linker script, I noticed that although MBED_RAM_SIZE = 0x00045800, MBED_RAM_START is set to 0x08002000, so I think we can't add MBED_RAM_SIZE to FLASH_CM0P_SIZE + MBED_APP_SIZE....


                              Thanks,
                              Dennis

                              • 13. Re: PSoC 62 Application flash size
                                WiWi_4702256

                                Dennis,

                                 

                                Cool, very cool, we have a branch that does wearable's too... I built a wear leveling algorithm for NOR for them. The device is worn by the crew-members as they go about their daily activities onboard the International Space Station. The device monitors and stores CO2 levels and stores the data in external flash, soon as they get within range of a laptop on board it connects and downloads the data via BLE to the laptop and then to the ground.

                                 

                                So your just going to add FLASH_CM0P_SIZE + MBED_APP_SIZE and give it a try? I think your right. Let me know if that works.

                                 

                                As far as the MBed OS issue(s), I actually can't recall the specific issue at this point however, I do recall my personal feelings about using CLI and IDE to develop with so its more personal preference with using CLI and IDE to develop than issues that made me go to FreeRTOS.

                                 

                                This will be my first application written that uses an OS on an "embedded" device. I've always used Interrupt Architecture to develop our applications. However, with these Cypress SoC MCU's, you really need an OS.

                                 

                                I've bumped into FreeRTOS several times at work, and even though we work with ARM MCU's (TI's RM48) I really have not heard of mbed OS until I started consulting and working on this side project... I am doing some remote consulting work...

                                 

                                I really have enjoyed learning this new Cypress environment and learning about IoT, its very cool! However, its been a painful sharp learning curve for me. Both with Cypress, IoT, AWS... AWS is like the rain forest, its overwhelming, yet with the AnyCloud community I've been able to control my devices from the cloud. Currently I am working on uploading and downloading files to from a S3 bucket... Feels like a firehouse of knowledge being shoved into my brain... LOL! Haven't figured out S3 buckets yet (specifically policies) but I will...

                                Keep me posted,

                                William

                                • 14. Re: PSoC 62 Application flash size
                                  DeWa_4681626

                                  Hi William,
                                  Thanks for sharing your project! It sounds very cool and must be an honor to make contribution to the international space station!

                                  I have signed an NDA, so I can't disclose too much details on my work. Otherwise, I would be happy to share what I do as well.

                                   

                                  This is my first time using Cypress MCU and mbed as well. Personally, I feel mbed has good support to run on PSoC; they have rich APIs in various features and the code is open source, so it also makes debug easier especially when I needed to look into how the APIs were implemented...

                                   

                                  Regarding the memory map, I reviewed the linker script again, I think currently, it is only computing FLASH_CM0P_SIZE + MBED_APP_SIZE for the flash section, right?
                                  Since MBED_RAM_START starts at 0x08002000, MBED_RAM_SIZE won't be added to the flash section, right? Or perhaps I misunderstood how the linker script works... Does the linker still add these (MBED_RAM_SIZE, FLASH_CM0P_SIZE, MBED_APP_SIZE) together and try to fit them in the flash section?

                                  Thanks,

                                  Dennis

                                  1 2 Previous Next