Changes

KFLOP C Programs

968 bytes added, 20:07, 5 March 2016
C Program Size and Stack Limitations
<span class="mw-headline">For general C programming references/tutorials, s</span>ee the links listed near the bottom of [http://dynomotion.com/Support.html this page].
For KFlop specific references, all available variables and functions are listed in the KMotionDef.h file, located within the DSP_FLOP directory at <KMotion Installation Directory>\DSP_KFLOP. An index of the available variables and functions can be found in the [[KMotionDef]] page.
===<span id="Simplest_C_Program" class="mw-headline">Simplest C Program</span>===
int    PC_comm[N_PC_COMM_PERSIST];// 8 persist Variables constantly uploaded to send misc commands/data to PC
 
 
 
==C Program Size and Stack Limitations==
Each of the first 6 User Thread Memory Spaces are limited to 64KBytes (65536 Bytes).  Thread 7 is larger and limited to 5x64KBytes (327680Bytes).
 
If subsequent Threads are unused it is possible to overflow into their Thread Spaces.
 
 
When compiling a message is displayed showing the Memory Usage.  The total value indicates the total amount of memory used and must fit into the allowed memory space.
 
No Errors, No Warnings, text=100, bss=0, data=14, total=160
 
 
Each User Thread Stack is located in precious single cycle (5ns) internal memory and is 2 KBytes in length.  Care should be used to limit stack usage.  Overflowing the stack will likely cause KFLOP to crash.  Local variables (defined within functions) and passed function parameters reside on the stack.  Large variables should be defined as Global Variables or in the 8 MByte [http://www.dynomotion.com/wiki/index.php?title=KFLOP_C_Programs&action=submit#Gather_Buffer Gather Buffer]
Bureaucrat, administrator
469
edits