AnsweredAssumed Answered

Sprintf/sscanf not working anymore when increased memory usage

Question asked by Jeroen_ on Oct 19, 2017
Latest reply on Nov 13, 2017 by Jeroen_



I have a BF514 with external SDRAM (H55S1G62MFP) connected and I am using VisualDSP++ 5.0 Update 10.1.


My project was using a little bit (1.496.778 bytes in the first 2 banks) of the 1Gb external SDRAM. In the project settings the size of the external SDRAM was set to 16MB. 

Now I want to implement a new feature which requires large buffers. So I have set the external SDRAM to 128 MB and changed the .ldf file so the data which was already in the first 8MB of the SDRAM is still at the same place. I need a buffer of 120.000.000 bytes. That takes about 3,5 bank of the SDRAM. With the #pragma section I place the 4 buffers in the SDRAM with a total size of 120.000.000 bytes. The buffers are only declared and not yet referenced.


#pragma section("sdram0_bank0_new")
uint16 bufferTest0[9668391];

#pragma section("sdram0_bank1_new")
uint16 bufferTest1[16777216];

#pragma section("sdram0_bank2_new")
uint16 bufferTest2[16777216];

#pragma section("sdram0_bank3_new")

uint16 bufferTest3[16777177];


I see in the Memory Map of the Expert Linker that it is placed on the correct place in the SDRAM. So that seems to be working. 


But when I program the software in the BF514 with the ICE-100B with the Flash Programmer under Tools the program 'hangs' when a sprintf or sscanf must be executed. 


As I can see the sprintf/sscanf are handled by the libio532.dlb / libc532.dlb. I see those libs in bank0 of the SDRAM but also in the noncache_code, L1_code, bsz, constdata, program adn voldata input sections. 


The optimization was set to 100% but also with the optimization off results in the same behavior. 

When I turn the debug information on and run the project in the debugger the sprintf/sscanf are working. But when I program the same program (without changing anything) with the Flash Programmer in the BF514 the program hangs when the sprintf or sscanf must be executed. 


When I set the declaration of the buffers in comments and program with the Flash Programmer the software in the BF514 the sprintf/sscanf are working again. For the rest I have not changed anything so the .ldf file is still the same. 


What causes that the sprintf/sscanf are not working anymore when I place data at memory which was not in use before?


Thank you in advance for your reply!


Best regards,