- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using CYC8KIT-062S4, FWIW.
When I create the Dual-CPU Empty PSoC6 App, I see a file called system_psoc6.h located under bsps\TARGET_APP_CYC8KIT-062S4. The instructions in linker.ld advise changing the CY_CORTEX_M4_APPL_ADDR value in this file to reflect the length of the CM0P application. This worked in MTB 2.4, however it no longer has any effect in MTB 3.0. The reason appears to be that CY_CORTEX_M4_APPL_ADDR is already defined when this header is included--but where?
I changed my CM0P application to have a length of 0x8000. I then changed the definition in system_psoc6.h to look like this:
#if !defined (CY_CORTEX_M4_APPL_ADDR)
#define CY_CORTEX_M4_APPL_ADDR (CY_FLASH_BASE + 0x8000U)
#endif /* (CY_CORTEX_M4_APPL_ADDR) */
Upon running the application, I see a crash when the M4 is enabled.
If I comment out the 'if !defined' like so...
//#if !defined (CY_CORTEX_M4_APPL_ADDR)
#define CY_CORTEX_M4_APPL_ADDR (CY_FLASH_BASE + 0x8000U)
//#endif /* (CY_CORTEX_M4_APPL_ADDR) */
...and rebuild, I get a ton of 'redefined' warnings, however the application then runs correctly.
Seems like the instructions in linker.ld could use an updating?
Solved! Go to Solution.
- Tags:
- junk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, after poking around a bit more, I found the problem. For some reason, the Makefiles in the CM0 projects now all contain the following line, which seems like a bug:
# Add additional defines to the build process (without a leading -D).
DEFINES+=CY_CORTEX_M4_APPL_ADDR=CY_FLASH_BASE+0x4400U
Any idea why this was added? It's not in the MTB 2.4 Makefiles for the same samples. I causes the #define in system_psoc6.h to be redundant and beaks the instructions in that same header, which say nothing of updating the Makefile.
I removed this line from the Makefile and everything is now happy. Please consider fixing this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @jaholmes,
We tried to recreate the issue.
But we didn't encounter a crash when the M4 is enabled.
Can you please send the screenshot of the error that you are getting?
Warm Regards,
Gautami J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Gautami - The easiest repro is this:
1) Create a new Dual-CPU Empty PSoC6 App, *** do not build yet! ***
2) Modify the CM0p linker.ld to make the flash size 0x8000:
flash (rx) : ORIGIN = 0x10000000, LENGTH = 0x8000
3) Modify the CM4 linker.ld to reflect the same:
FLASH_CM0P_SIZE = 0x8000;
4) Modify the system_psoc6.h to reflect the same. NOTE: Although the default CM0p flash size in linker.ld is 0x4400, the FLASH_CM0P_SIZE in system_psoc6.h defaults to 0x2000, which seems wrong, and is the first sign that FLASH_CM0P_SIZE is actually getting defined someplace else.
#if !defined (CY_CORTEX_M4_APPL_ADDR)
#define CY_CORTEX_M4_APPL_ADDR (CY_FLASH_BASE + 0x8000U)
#endif /* (CY_CORTEX_M4_APPL_ADDR) */
5) Build the whole application.
6) Run it. You'll see the telltale indication of a crash right away in the console:
7) Modify system_psoc6.h to force redefinition by commenting out the #if !defined...
//#if !defined (CY_CORTEX_M4_APPL_ADDR)
#define CY_CORTEX_M4_APPL_ADDR (CY_FLASH_BASE + 0x8000U)
//#endif /* (CY_CORTEX_M4_APPL_ADDR) */
8 ) Clean/rebuild everything. You'll get a bunch of warnings about redefinition of CY_CORTEX_M4_APPL_ADDR.
9) Run it. It runs fine now.
So there are a few issues here. For one, the default system_psoc.h seems to have the wrong definition for CY_CORTEX_M4_APPL_ADDR in it. It defaults to CY_FLASH_BASE + 0x2000 even though the CM0p linker.ld defaults to 0x4400. The second and most perplexing issue is: Where is CY_CORTEX_M4_APPL_ADDR actually getting defined. The indexer won't show me. The definition in system_psoc6.h is not being used anymore, which is why the incorrect default value doesn't seem to matter. The third issue is that the instructions in linker.ld still say to update the CY_CORETEX_M4_APPL_ADDR definition in system_psoc6.h, however that doesn't work, as the steps above illustrate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, after poking around a bit more, I found the problem. For some reason, the Makefiles in the CM0 projects now all contain the following line, which seems like a bug:
# Add additional defines to the build process (without a leading -D).
DEFINES+=CY_CORTEX_M4_APPL_ADDR=CY_FLASH_BASE+0x4400U
Any idea why this was added? It's not in the MTB 2.4 Makefiles for the same samples. I causes the #define in system_psoc6.h to be redundant and beaks the instructions in that same header, which say nothing of updating the Makefile.
I removed this line from the Makefile and everything is now happy. Please consider fixing this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @jaholmes ,
Apologies for the delay in reply.
Thanks for suggesting the fix.
Warm Regards,
Gautami J