DS80C400 C Libraries: Development Issues
- When writing an interrupt in 8051, make sure to preserve DPS and PSW. Consult the DS80C400 User's Guide for
information on proper values of these registers for your use.
- When using interrupt code written in C, make sure the Keil project option Use Multiple DPTRs is checked
so that DPS is preserved.
- Applications that use the the socket libraries should call the
clear_param_buffers function
immediately after calling the init_rom function.
- To increase the accuracy of the system millisecond timer, call the function
task_settickreload soon
after rom initialization.
- If your application uses multiple processes, turn off the overlay analyzer in the Keil tools. This can be done
in the Project Target Options dialog, under the LX51 Misc panel. Type the word NOOVERLAY in the
edit box labeled Misc Controls:.
- If you are having problems with keeping network connectivity after a reset, this message may apply:
http://lists.dalsemi.com/maillists/tini/2003-May/026053.html.
- If you write any 8051 code that will be called from C, note that pointers as they are passed down
from C code aren't immediately usable in 8051, and pointers that are usable in 8051 must be altered
before they are suitable for C use. Use the macro
FIXKEILPOINTER to change the high byte of
a pointer passed down from C into something usable in 8051. For example, if the pointer is passed
to assembly in r3:r2:r1...
FIXKEILPOINTER r3
The parameter should be the register or direct that contains the high byte of the pointer. To alter a
pointer back so it can be returned to the C program...
UNFIXKEILPOINTER r3
- Do not initialize any variables declared as 'data' (that is...any variables in internal RAM) until
after the
init_rom function has been called. Variables declared as 'data' will be initialized
to zero when init_rom is called.
- If your applications cannot create more tasks or accept more sockets and you have plenty of RAM, you have
probably run out of kernel memory. Use the new Kernel Memory Allocation library to increase the amount
of kernel memory your application uses.
- Make sure that you do not mix the Keil memory allocation and de-allocation routines with the
Dallas Memory Management de-allocation and allocation routines. These allocation routines have very
different memory structures and draw from different pools of memory.
- The power-fail-reset bit and the watchdog-reset bit are not available for application use. They
are saved at data location
21h before application code starts running. The watchdog-reset
bit is stored in bit 4 of data location 21h, and the power-fail-reset bit is stored in
bit 3 of data location 21h. This information will be destroyed when the ROM task
scheduler is initialized, so these values should be stored in XDATA if needed before any ROM
initialization functions are invoked.
- When writing applications using UDP sockets, note that even if you don't actively call the recvfrom
function, the network stack will store received messages to an active socket, which consumes kernel buffers.
It is probably a good idea to occasionally call recvfrom to make sure that those kernel buffers are free.
- Many Keil provided functions are not safe to be called from multiple processes. For instance, String formatting
functions such as printf and sprintf should not be called from multiple processes without
some kind of concurrent access protection.
- The Keil C51 compiler's On-chip Arithmetic Accelerator routines are NOT thread safe. Use of these routines may
cause unpredictable behaviour and should be disabled in the "Target Options" dialog window. For more information,
and a work around see:
http://www.keil.com/support/man/docs/c51/c51_dv_dallasmathaccel.htm
- Keil C51 compiler currently has limitations associated with far pointers and 64K boundaries. Example: a pointer
is set at 0x02FFFE, increment the pointer once to 0x02FFFF, increment again and it should point to 0x030000
however it will actually point to 0x020000. For more information about this limitation and for a workaround
see:
http://www.keil.com/support/docs/2800.htm
http://www.keil.com/support/docs/2276.htm
http://www.keil.com/support/man/docs/c51/c51_le_far.htm
- Keil C51 compiler has a Optimization bug related to TIMED ACCESS. Common Block Subroutine Optimization breaks Timed Access
by keeping the TA=0xaa;TA=0x55; in a common subroutine instead of keeping it inline. So, Make sure the Optimization level
is less than 9. Also, the higher optimization levels tend to add LCALL instructions to subroutines instead of leaving the
code inline. Setting optimization level 7 will give all optimizations except for "subroutining". This can be done locally
with the use of #pragma OPTIMIZE(7) then reset to desired optimization level as #pragma OPTIMIZE(9).