ret = pSpifi->spifi_init(&obj, 3, S_RCVCLK | S_FULLCLK, 12); }
pSpifi points correctly to spifi_table, which is linked into my program code (0x1a035198). The spifi functions from the library are also correctly linked into the program (e.g. spifi_init at 0x1a01309c).
During linking, I get the following warning: ld.exe: warning: C:\T\IPD10G2\M4\Bsp\Cmsis\spifi_drv_M4.lib(spifi_rom_api.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
Running the program ends in an exception. I debugged the assembler code of the spifi library: in the init function a ldr-Instruction loads data from 0x29004018 (see screenshot), which is obviously an invalid address.
I use the library which is mentioned above (file size: 35468 bytes). My controller is a LPC4357.
Content originally posted in LPCWare by bavarian on Wed Sep 11 04:44:00 MST 2013 Hello Holger,
GCC assumes that wchar_t is a 4-bytes type by default. ARMCC assumes it is a 2-bytes type by default.
This means that creating a library with ARMCC and use it in GCC (and also vice versa) creates a warning, and in case of the SPIFI lib even a runtime error. There are options in both toolsets to force usage of 4-bytes and 2-bytes types, but in fact the problem goes a little bit deeper than that.
In NXP we currently work on a solution of this conflict for the Cortex-M3/M4 SPIFI libs. We will keep you updated on this.