How can i use sprintf in JN5168

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i use sprintf in JN5168

Jump to solution
2,595 Views
xubovey
Contributor III

when i use sprintf and sscanf function. i get some errors as following:

and i have tried: JN5168, eclipse and atof 

Added an entry in .bss before the close } as

_end = (.)

 

Then in .stack, added a line before the close } as

_stack = (.)

but it not work. what should i do to make it work well. thanks~

Linking Coordinator_JN5168.elf ...
/c/NXP/bstudio_nxp/sdk/JN-SW-4163/../Tools/ba-elf-ba2-r36379/bin/ba-elf-gcc -Wl,--gc-sections -Wl,-u_AppColdStart -Wl,-u_AppWarmStart -TApp_Stack_Size.ld -march=ba2 -mcpu=jn51xx -mredzone-size=4 -mbranch-cost=3 -fomit-frame-pointer -Os -fshort-enums -flto -nostartfiles -L/c/NXP/bstudio_nxp/sdk/JN-SW-4163/Chip/JN5168/Build -L/c/NXP/bstudio_nxp/sdk/JN-SW-4163/Chip/JN5168/Library -L/c/NXP/bstudio_nxp/sdk/JN-SW-4163/Platform/DK4/Library -L/c/NXP/bstudio_nxp/sdk/JN-SW-4163/Components/Library -L/c/NXP/bstudio_nxp/sdk/JN-SW-4163/Stack/MAC/Build -TAppBuildMac.ld -o Coordinator_JN5168.elf ...... .o -Wl,--start-group -lAppApi_JN516x -lMAC_JN516x -lTimerServer_JN516x -lTOF_JN516x -lXcv_JN516x -lAes_JN516x -lHardwareApi_JN516x -lMicroSpecific_JN516x -lBoot_JN516x -lPDM_EEPROM_JN516x_NO_RTOS -lBoardLib_JN516x -Wl,--end-group -Wl,-Map,Coordinator_JN5168.map
c:/nxp/bstudio_nxp/sdk/tools/ba-elf-ba2-r36379/bin/../lib/gcc/ba-elf/4.7.4/../../../../ba-elf/lib/mcpu_jn51xx_sizeopt\libc.a(lib_a-glue.o): In function `_sbrk':
/ba_toolchain/r36379/source/gcc-4.7.4-ba-r36379-build/ba-elf/mcpu_jn51xx_sizeopt/newlib/libc/sys/basim/../../../../../../../gcc-4.7.4-ba-r36379/newlib/libc/sys/basim/glue.c:77: multiple definition of `_sbrk'
C:\Users\xubov\AppData\Local\Temp\ccJW4fKI.ltrans4.ltrans.o:ccJW4fKI.ltrans4.o:(.text+0xafb): first defined here
c:/nxp/bstudio_nxp/sdk/tools/ba-elf-ba2-r36379/bin/../lib/gcc/ba-elf/4.7.4/../../../../ba-elf/lib/mcpu_jn51xx_sizeopt\libc.a(lib_a-glue.o): In function `_sbrk':
glue.c:(.text+0x179): undefined reference to `end'
glue.c:(.text+0x18e): undefined reference to `_stack'
glue.c:(.text+0x197): undefined reference to `_stack'
glue.c:(.text+0x197): relocation truncated to fit: R_BA_8 against undefined symbol `_stack'

Tags (2)
0 Kudos
1 Solution
2,108 Views
xubovey
Contributor III

thanks for your reply.

i want convert a int or float number to a string. then send out by uart or zigbee.

i rebuild the _sbrk function. And it work  well know.

View solution in original post

6 Replies
2,108 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

Do you want the printf for debug purpose?

What is the AN that you are working on?

Regards,

Mario

0 Kudos
2,109 Views
xubovey
Contributor III

thanks for your reply.

i want convert a int or float number to a string. then send out by uart or zigbee.

i rebuild the _sbrk function. And it work  well know.

2,108 Views
liuxiang
Contributor I

Hi,xu bovey

How do you implement the _sbrk function? Let me refer to it? Thank you.

0 Kudos
2,108 Views
xubovey
Contributor III

hi, hope it will help u.

unsigned char HEAP[128];

caddr_t _sbrk ( int incr ){
static unsigned char *heap = NULL;
unsigned char *prev_heap;

if (heap == NULL) {
heap = HEAP;//(unsigned char *)&__HEAP_START;
}
prev_heap = heap;


heap += incr;

return (caddr_t) prev_heap;
}

1,775 Views
GP_Mao
Contributor I

hi!This looks very good, but I don't know how to implement this function in  libc.a.

 can you show me the way  to implement it, thank you very much  !

0 Kudos
2,108 Views
小鹏陈
Contributor II

Hi xu bovey.

   I hope to implement the _sbrk function,but i can`t find it.

0 Kudos