A N 3 7 0
14
Rev. 1.0
It is up to the user to adjust the recommended sizes above according to the application true needs.
It is recommended to reserve the stack size by modifying the line defining the reserved size of the stack in
startup.a51 (in the published examples the <example>_startup.a51 is distributed) to the proper value. By doing that
the linker will notify the user when the reserved stack area is encroaching on other DATA/IDATA variables:
;---------------------------------------------------------------------------
;
; CODE:
;
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
; -- Nominally the DS 1 is used for the STACK segment. However, if we want
; to reserve a desired space and make sure that we are not overflowing
; sizes we should allocated desired amount here.
RSEG ?STACK
DS 32 ; Reserve 32 bytes of the stack
The user is responsible of setting the beginning of the STACK segment on the linker command line as explained in
application software building section. Any change of the stack size requires the linker command line to reflect the
change.
4.5. Hardware Thread Safety
Almost all of the API functions access hardware. If the function accessing the same hardware is going to be used
in the main application and in the interrupt service routine (ISR) then there is a conflict. There are no semaphores
nor any hardware access protections implemented in the API routines. From hardware point of view, the API
functions should be treated as not thread safe.
4.6. Non-ISR Functions
Certain functions in the ROM are not allowed to be called from an interrupt service routine (ISR). This is because
they share memory space (DATA, IDATA, XDATA) with other functions in the form of their local variables. Sharing
variables is a way to reduce the use of memory. The reason that calls from an interrupt service routine are not
allowed is because of the possibility of two functions running at the same time which are relying on the same
memory space. Following is a list of functions which may not be called from within any interrupt service routine.
vAes_Cipher()
vAes_InvCipher()
vAes_InvGenKey()
wBsr_Pop()
wBsr_GetCurrentButton()
lMtp_DecToGray()
lMtp_GetDecCount()
vMtp_IncCount()
vSleepTim_GetCount()
vSleepTim_SetCount()