cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox General

Honored Contributor

To all,

I have working PSoC Creator that I ported to MTB.

It is generally working however trying to use snprintf() on a 64-bit variable (long long) is not working.

Here is the code fragment:

...

uint64 uid;

uint16_t tstr_sz[50]

#if (CYDEV_CHIP_FAMILY_USED == CYDEV_CHIP_FAMILY_PSOC6)

    uid = Cy_SysLib_GetUniqueId();

#else

    CyGetUniqueId((uint32 *)uid);

#endif

    snprintf(tstr, sizeof(tstr), "Unique Silicon ID: %.8llX\r\n",  uid);

    UART_PutString(tstr);

...

When compiled from PSoC Creator I get:

Unique Silicon ID: ED2F482D69619DA

When compiled from MTB I get:

Unique Silicon ID: llX

Using PSoC Creator I needed to set to get 64-bit vars to work:

pastedImage_10.png

Is there a similar setting in MTB?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply
1 Solution
Moderator
Moderator

Hi Len,

You have to do the same thing in MTB as well. You need to switch to newlib instead of newlib-nano to print long long which is default disabled in nano specs.

The way to achieve this is: Migrate to <your_app>/libs/psoc6make/make/toolchains/GCC_ARM.mk and modify the CY_TOOLCHAIN_LDFLAGS in the following manner.

pastedImage_0.png

Let me know if this does not work help.

View solution in original post

2 Replies
Moderator
Moderator

Hi Len,

You have to do the same thing in MTB as well. You need to switch to newlib instead of newlib-nano to print long long which is default disabled in nano specs.

The way to achieve this is: Migrate to <your_app>/libs/psoc6make/make/toolchains/GCC_ARM.mk and modify the CY_TOOLCHAIN_LDFLAGS in the following manner.

pastedImage_0.png

Let me know if this does not work help.

View solution in original post

Honored Contributor

RaktimR,

Thank you.  That worked.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply
Top labels