support

Can my variables straddle resource boundaries?

|

In general, no. Boundaries created by the hardware or instruction set restrict how the compiler can allocate variables.

Wherever an architecture uses pages or other interrupted address spaces, there is the potential that a variable will straddle such a boundary. The risk is greatest when you specify the address of a variable in terms of another:

int one; //in one area
int two; //in another area
long three @ one; //oh oh... 

I'm getting lots of "redeclared" error messages in my header files. What's wrong?

If you've authored your own device header file or other header file (e.g., for a library), check to see if it has standard C header protection in it.

The code looks like this:

#ifndef __HEADER_H
#define __HEADER_H 
/* Body of the header file. */ 
#endif /* __HEADER_H */

Replace HEADER_H with the filename of your header file, changing any periods for underscores.

Two of my variables are overlapped; they occupy the same physical location in RAM. What's wrong?

The compiler has allocated two variables from two different memory spaces that happen to share the same physical locations. The declarations of these memory spaces need to be corrected.

If two named memory spaces (as declared with #pragma memory RAM) share the same or similar parameters, there's a chance that allocations could overlap. Alter the memory space declaration to avoid the overlap.

eTPU_C

Are functions reentrant?

|

Functions are not reentrant. The local variables are not placed on a stack; their address is set at compile time. If a function calls itself, or a function is being executed from both the main loop and within an interrupt, the second call to the function will use the same memory. In this case local variables will become corrupted.

ETPU_functions are reentrant, in the sense that multiple channels can dispatch the same function.

C functions called from within ETPU_functions are not reentrant.

Division isn't working as I expect. What's wrong?

In C, both multiply and divide return numbers of the same precision as their arguments. This implies:

How do I determine what processor state to preserve during interrupt calls?

Short answer: read the processor documentation, then compile your program and check. The processor's response to ISRs must be documented. The compiler's response will appear in the compiled code.

Fuzz-C

What is "Fractional Math"?

|

Mathematic calculations that operate between 0 and 1. It is used in numerous situations, including Fuzzy Logic and Linguistic Variables.

I'm getting an "Undefined symbol(s)" error that refers to '__MUL8x8'. What's wrong?

__MUL8x8 is the name of a library routine required by the compiler. It is found in the "math library" supplied with the Code Development System. The library name is usually

processorname.lib

where processorname matches the part name or family name of the target processor.

The compiler will search for this file along its LIBRARY path.

I've compiled a source file, but the listing file shows no generated assembly. What's wrong?

If you chose to generate an object file (.OBJ), the compiler will not generate executable assembly code. The object file is an intermediate format, suitable for linking with BClink, or through Absolute Code Mode; in either case, code generation is always the last step. Even if you selected an executable (hex dump) format, the compiler will not generate assembly when it generates an object file.

C38 C6805 C6808 COP8C Cypress C eTPU_C Fuzz-C MPC SXC Z8C

I have an application developed with an old version. Will it compile properly with the latest version?

| | | | | | | | | |

Yes. If you have written your program according to our recommended practices in the product documentation, upgrading should be seamless. All Byte Craft Limited Code Development Systems have backward compatibility with previous language constructs.

Please note:

  • Improvements in the compiler can alter the generated code; this may impact your testing.
  • Device header files may change between versions. If you've written customized device header files, they may require some revision. Simply examine the stock headers that we ship with the product.
Syndicate content