Topics in this FAQ area are grouped as follows:
Q: How do I install my Raisonance products ?
A: First activate your software, then check your registration has worked. You can now use your software.
Q: How do I activate my software ?
A: CD Installation:
Follow the instructions
Once the installation has completed: Launch Ride6 software:
o Modify Activation code
o Then go to the following page of the Raisonance web site:
http://www.mcu-raisonance.com/activation_code.html
o Add your company name, your serial number, and copy the serialization code from Ride7.
o Click to get your activation code.
o When you see the activation code, copy it into the relevant boxes in Ride7.
o Click on Register Activation Code.
Q: How do I verify my registration has worked ?
A: Go to Help/About, click on 8051 Tool Chain and check the tool capabilities (the limitation should now correspond to the tool you have bought), click OK, close.
You can now use your software.
Q: Why does the I2C peripheral for the 552 microcontroller not work with the simulator?
A: Not all the peripherals of every microcontroller have been (or can be) implemented by the simulator. Their 'views', however, can be seen via the emulator or with a monitor. That is why some of the microcontrollers have a star as a suffix in the 'Options | Debug', window. The star indicates that some peripherals of the microcontroller are not supported. The list below shows which peripherals are not supported on some 8051 devices:
Q: When I simulate my program some local variables are not displayed correctly: what should I do ?
A: Some Raisonance projects need an extended OMF51 format, called OE2, to display properly all local variables.
Make sure you select the OE2 format by checking the box 'Extended 1997 version (OE(2))' in Options|Project|RC51|Object.
Q: How can I simulate external interrupts, that is, how can I generate an edge on a pin that will cause an interrupt to occur?
A: The simplest way is:
If you want your interrupt to occur at a given time you can connect the pin to a waveform generator rather then switching it manually.
If your interrupt routine is programmed correctly (right address, right priority, right enable mask and so on), the program execution will stop at the breakpoint.
Q: What are the limitations of the demo version ?
A: All tools are limited to 4Kb. That means that you cannot compile modules of more than 4Kb, you cannot link modules whose cumulated size is greater than 4Kb and you cannot simulate imported programs greater than 4Kb.
Q: Which other C syntax extensions are accepted by the RC51?
A: RC51 in compatible with C51 from Keil. This means that most programs written for the Keil compiler will compile with RC51 with very little modifications or no modifications at all.
Q: How do I specify a pointer and its pointed object?
A: A pointer is represented by a * (star) symbol: what is on the left of the star specifies what the pointer is pointing to, what is on the right of the star specifies details about the pointer itself.
Example:
char * ptr;
specifies a pointer named 'ptr' pointing to a character. The character can be anywhere in the memory space (code or data - the pointer is said to be 'generic') and the pointer itself can be anywhere in the data space.
You can specify more details about both the pointer and the pointed object, like in
int code * idata foo;
in this case you declare a pointer named foo, located in idata and pointing to a variable of type int, located in code.
The general rule is as follows (optional means that this part of the declaration is not mandatory):
pointer_storage-class-specifier (optional) pointed_object_definition (optional) * pointer_definition;
where
pointer_storage-class-specifier: one of: auto register static extern typedef at address
pointed_object_definition: type-specifier(optional) pointed_object_qualifier(optional)
remark: type-specifier is recommended; at least one specifier is needed before star
pointer_definition: pointer_qualifier(optional) direct-declarator
type-specifier: one of: void char short int long float double signed unsigned struct-or-union-specifier enum-specifier typedef-name
pointed_object_qualifier: one of: code, data, idata, xdata generic and/or const and/or volatile
pointer-qualifier: one of: code, data, idata, xdata
default space qualifiers: The default space qualifier for the pointed_object_qualifier is: generic.
The default space qualifier for the pointer_qualifier and the pointed_object_qualifier in case the NOGENERIC pragma is defined is:
models TINY and SMALL: data,
model COMPACT:pdata
models LARGE and HUGE:xdata.
More examples:
at 0xA0 char * idata pchar_data;
pchar_data defines a pointer located in idata at the address 0xA0 pointing to a char.
extern int code * data pint_fcode;
pint_fcode defines an extern pointer located in data pointing to an integer located in code.
typedef char data * ptype;
ptype defines the type of a pointer pointing to a char in data. Remember: no pointer-qualifier is allowed with typedef as pointer_storage-class-specifier!
Q: How do I define a generic pointer? How do I define a space qualified pointer?
A: A generic pointer is a pointer that can point anywhere in the memory space. A space qualified pointer is a pointer that can only point at a specific space, defined when the pointer is declared. Space qualified pointers are typically smaller than generic pointers, and therefore generate more efficient programs.
A generic char pointer is defined as follows: char * pointer_name;
A Code qualified pointer is defined as follows: char code * pointer_name;
A XData qualified pointer is defined as follows: char xdata * pointer_name;
In addition to specifying where the pointer is pointing you can also specify where the pointer is located (for example, you usually want to locate frequently used pointers in data, because that's the place where they are accessed the fastest)
If you want to define a code qualified pointer located in xdata space, you have to write : char code * xdata pointer_name;
Q: When I access elements of the object my pointer is pointing to, the program starts behaving strangely. Why?
A: This is typically due to a non-initialized pointer. Consider the following program:
typedef struct {
int a;
int b;
} mystruct;
void main(void)
{
mystruct *foo;
foo = 1;
foo = 3;
}
Here, you declare the pointer foo and then you try to access elements of the object it points to. However, foo does not point to any well defined object yet, because no object has been assigned to it.
Therefore, when foo = 1 is executed you are going to write the value 1 in some unspecified memory location: this can have different consequences:
- nothing: if foo is pointing to an unused memory location;
- modification of other, unrelated variables;
- modification of some registers, resulting in unexpected program behaviour;
- modification of the code, resulting in bad program execution.
The solution to this problem is to always assign a pointer to an object before using it, as in the following example:
typedef struct {
int a;
int b;
} mystruct;
void main(void)
{
mystruct i;
mystruct *foo;
foo=&i;
foo = 1;
foo = 3;
while(1);
}
Q: Where do I find the include file defining the specific Special Function Registers (SFRs) of my derivative ?
A: In the RIDE\inc folder . Choose the *.h file that corresponds to your microcontroller. If it does not exist you can create it by editing one of the existing files and adding the SFRs that you require.
Q: My program does not compile because of too many warnings. What can I do?
A: Go to 'Options | Project | RC51 | Messages'. Set the 'Stop after n warnings' limit to a higher value.
To avoid seeing all the warnings you can set "warning level" lower (0 => no warnings are printed, 1 => some important warnings are printed, 2 => all warnings are printed).
Q: Are there predefined date and time macros in the 8051 compiler?
A: Yes, the predefined __DATE__, __DATE2__, __DATE3__ and __TIME__ macros exit. Refer to the section 'Predefined Names' in the manual for further information. Note '__' is double underscore.
Q: Can I include assembler statements in my C source file? Why do I get error #C125?
A: Yes, you can include assembler in your C source, using the "asm" and "endasm" pragmas but you need a little 'trick' as follows:
1. In Ride7, open 'Options | Project | RCXXX | Object' and select the 'Generate an assembler source file (.SRC)' radio button. If option is not selected the compiler will generate an error #C125.
2. Add a node to your project. This node must be called filename.src and must be *below* the node containing the C source file.
3. Edit the properties of the node containing the C source (right-click on it and choose Properties) and uncheck the box "Include this node in the link of the project".
3. Edit the properties of the node containing the .src file and choose the right assembler in the "Translate with" list.
4. You are now ready to build your project.
Note: although including assembler in your C sources is feasible as explained above, we recommend you would rather investigate the possibility to write all your assembler functions in a separate source file and make the necessary connections between the two modules using the EXTERNAL/PUBLIC keywords.
Q: At the end of my program, completely unrelated pieces of code are executed and a lot of errors occur. What is wrong?
A: After the last instruction in the main function has been processed, the program executes a 'RET' instruction, which accesses an undefined stack entry. Therefore, the program can execute code from anywhere in Code space and produce errors. This is because with microcontrollers, unlike PCs, the execution thread cannot be passed back to an operating system.
To avoid this problem just add an infinite loop at the end of your program (example: 'while(1);').
Q: When I simulate my program some local variables are not displayed correctly: what should I do ?
A: Some Raisonance projects need an extended OMF51 format, called OE2, to display properly all local variables.
Make sure you select the OE2 format by checking the box 'Extended 1997 version (OE(2))' in Options|Project|RC51|Object.
Q: When I try to load my program in a non-Raisonance emulator I have an error message 'Unknown OMF record type' : what should I do ?
A: Most non-Raisonance emulators currently support only 'standard OMF51' (OE) debugging format.
Some Raisonance projects need a more complete OMF51 format, called OE2.
If you emulator does not support OE2 make sure you select the standard OMF format by checking the box 'Extended (OE)' in Options|Project|RC51|Object.
Note that using OE for a project that requires OE2 might result in not having access to some local variables during debug.
Q: What does the 'Enable ANSI Integer Promotion Rules' option mean?
A: The 'Enable ANSI Integer Promotion Rules' option (checked by default) tells the compiler to 'promote' the operands of an expression to the type of the biggest operand before calculating the expression itself.
Consider the following example:
char a,b;
int sum;
a = 0x80;
b = 0x80;
sum=a+b;
If the option is checked, a and b are promoted from char (1 byte) to int (2 bytes), before calculating a+b, therefore the result stored in sum will be 0x100.
If the option is not checked, the result stored in sum will be 0 (the most significant bit will be truncated).
Note that working with this option unchecked is not recommended, although it can generate a sligthly smaller code when calculating expressions such as the one above.
Q: How can I port a project originally written for Keil's c51 to Raisonance?
A: Raisonance and Keil compilers are basically 'compatible': this means that to port most Keil projects to Raisonance you just need to recompile and everything will work fine.
A few exeptions to this rule are:
- Space qualified pointers
When you want to specify both which space a pointer is pointing to AND in which space it is located, Keil's syntax is somewhat different from what ANSI says. Raisonance's syntax is closer to the standard.
Consider the following example, where you want to declare a pointer to a char in code memory, and the pointer has to be in data:
For Raisonance you would write
char code * data ptr;
while with Keil you would write
data char code * ptr;
A way to write a code that is correctly compiled by both compilers is to use typedef as follows:
typedef char code *tcptr2code;
data tcptr2code ptr;
For more information on how to define space-qualified pointers click here
- Signed and unsigned char
Char is signed by defalult in Keil. You can manually declare an unsigned char in the c source file by using the syntax
unsigned char x;
Char can be by default signed or unsigned in Raisonance depending on the option "Unsigned Characters" in Options|Project|RC51|Code Generation. The default value for this option is Unsigned Chars.
Note also that, with Raisonance declaring
unsigned char x;
or
char unsigned x;
is the same, while in Keil the second syntax is not accepted.
Q: Is there something special to do to use memory allocation functions with RC51 ?
A: Using memory allocation functions such as malloc() with RC51 requires to initialize the 'memory pool' first by using the mempool_init function.
The following code provides an example of a basic usage of malloc and mempool_init.
*******************************************************************
#include "alloc.h"
#include "stdio.h"
#include "string.h"
// Specify where the buffers will be allocated.
xdata unsigned char mempool_buffer[0x100];
char* buffer;
void main( void )
{
// Initialization of the memory pool
mempool_init( mempool_buffer, sizeof( mempool_buffer ) );
// Allocates a 40 bytes buffer
buffer = (char *)malloc( 40 );
if( buffer != NULL )
{
// Writes something in the buffer and then print it
strcpy( buffer, "hello" );
printf( "40 chars Buffer = %p, %s \n", buffer, buffer );
}
else
{
printf( "print buffer error %p \n", buffer );
}
while(1);
}
Q: Sometimes the result of an additon or multiplication is wrong: why ?
A: The first possibility is that the variable where the result of the operation it to be stored is not big enough to contain it (char can contain up to 255, int up to 65535 etc).
Another, more subtle, possibility is that the operands are of a smaller type than the result and that the 'Enable ANSI integer promotion rules is not checked': click here for an example.
Q: I try to call a function, but the function is never reached. The compiler does not generate any code for my function call. Why?
A: It's probably a matter of missing parenthesis ().
Consider the following example:
void init_eeprom(void)
{
}
void main(void)
{
init_eeprom(); // This is correct
init_eeprom; // This will not generate any code
}
Note that the wrong syntax without () will not produce any error or warning.
Q: When I use the compiler from the command line (or from a makefile), a huge .lst file is generated with every line number. How can I avoid this ?
A: This is a feature that is very useful when working in DOS 'on the screen', but it becomes unpractical when the output is redirected to a file, for example when using an external makefile.
To tell the compiler not to print too many lines use the QUIET option in the command line like in the following example:
RC51.exe C:\Ride\Examples\C\towers\towers.c LARGE QUIET
Q: How do I use the full 1kb of internal RAM available on some 8051 derivatives like the 89C51RD+ ?
A: Some 8051 derivatives, like the 89C51RD+, have 1Kbyte of internal RAM. However, only the first 256 bytes of this memory can be addressed as DATA/IDATA, while the rest must be accessed using the MOVX instruction, exactly as if this extra RAM was outside of the chip.
To use the full 1K you should therefore either declare some of your variables to be in XDATA or to use a memory model where variables are put in XDATA memory by default (COMPACT, LARGE and HUGE models).
You should also make sure that you application clears the EXTRAM bit (bit 1 of AUXR1), by doing this explicitly at the beginning of the code or by modifying the startup code.
Q: What does the startup code do? Do I need it? How can I modify it?
A: This note will tell you everything there is to know about 8051 startup code for Raisonance tools.
What is the startup code?
From the RC51 manual:
The Startup Code contains initializations needed to make your C program work correctly. It is executed at power-up and, when finished, it jumps to the “main” function of your application. An appropriate version of the startup code (depending on some parameters like memory model and others) is linked with the rest of the application when the “main” symbol is found by the compiler and performs a variety of initialization tasks including:
The Startup Code is written in assembler and can be found in the file ride\inc\sources\8051\rc51\startup.a51. It is recommended not to modify this file; if you need a specific initialization for your project we suggest you perform it at the beginning of the “main” function.
Do I need it?
If you are programming in C you definitely need the startup code in 99% of the cases (there could be exceptions, for example for modules that are not executed at power up, but rather called by other modules)
The standard startup code is included by the linker when the main() symbol is found (therefore, an easy way to avoid the startup code is to write a program without main() function), and works well for most cases (different chips, different HW configurations, different tools options), but, in some cases, you might want to extend or modify the startup code as explained below.
How is the startup code managed in RIDE?
Starting around BN729 (second half of 2002), RIDE offers 3 different possibilities to manage the startup code, as shown in the picture below (note that the Starup Opions are part of the Linker options, even if there is also 1 option in the compiler that can affet startup code)
The default option is "Default Startup". When you check this option, the linker will do the following:
This approach is the safest and is also pretty well optimized, but, in some cases, you might need extended startup functionality: in this case you can use one of the two options below.
Use this option when the startup code you need is totally different from what is provided by default with RIDE. When you use this option, the linker will simply not include any startup code (exactly the same as if your application contains no main() function): it's up to you to manually add a node in the project tree that contains some startup code. Note that, if you just take whatever C program and try out this option without adding a properly working startup code of your own, you will not even be able to start the debug session, as there will be no reset vector (a random part of your code will be put at address 0 and the stack will not be initialized behavior).
If you program in C, your specific startup code will need to do most of the things that are done by the standard startup anyway, so we suggest you use the method described below instead, but this option is left for cases where no startup altogther is needed (for example, as already mentioned, to compile a set of routines that will be launched by some other program)
Use this option when the startup code you need is basically the standard one, plus some micro-specific initialization (typically for HW features, such as buses, configuration bytes or peripherals).
When you use this option, RIDE will do the following:
You can now customize the startup file that is in the project tree by edtiting it (be careful to follow the guidelines provided in the comments).
Note that, some of the startup customizations that are done via the RIDE interface (example: Initialized RAM size) or automatically (example: way used to address >256 bytes of XDATA) are not taken into account here: you need to do everything manually by editing the startup.a51 file.
Micro dependencies: initialized Xdata variables of more than 256 bytes.
The startup code is usually not too much dependent on the particular 8051 derivative choosen, in what most of the micro specific features (usually peripherals) can be initialized in the main application, but there are some exceptions to this rule, including some SFRs initialization that must be done before accessing memory (example of the uPSD, this is managed by RIDE by automatically prefilling the "Micro-specific Initialization code" field) and accessing XDATA variables over the first 256 bytes.
Note first that the startup code only needs to access XDATA over 256 bytes if you have more than 256 bytes of initialized XDATA variables in your application: this is quite rare, but in case it happens you need to read the following.
Different 8051 derivatives implement different ways of accessing XDATA memory over 256 bytes: typically this is accomplished by using P2 as the high byte of the address, but some derivatives (especially those with internal XRAM) use different SFRs for this. The startup code is written to be as compact as possible, and will therefore try to intialize the XRAM memory using the MOVX @Ri instruction, but this does not work over 256 bytes when P2 is not used: in this last case the XRAM must be initialized using the MOVX @DPTR instruction.
When using the "Default Startup" option, the linker will choose which addressing mode to use according to the value of the option "Component with XRAM" shown below.
When using the "Micro-Specific Startup" option, you must edit the startup file if you need to initialize XDATA variable >256 bytes (look for INTERNAL_XRAM_LIKE_8xC592 in the startup.a51).
Q: How can I make several interrupt vectors execute the same interrupt routine ?
A: When declaring a function as an interrupt routine, you can use the special interrupt syntax:
void my_isr () interrupt 1
{
...
}
Unfortunately, several interrupt declarations for the same function are not allowed. A workaround for this is to write a macro to define each interrupt vector assembly code manually:
void my_isr () interrupt 1
{
...
}
typedef struct sIRQ_Vector {
char ToBeLJMP; //to be initialized with 0x02
void (*func) ( void ); // address of the function ended by RETI
} tIRQ_Vector;
#define VECT_TO_FCT(ref, func) at (8*(ref)+3) code tIRQ_Vector Vect_for_irq_##ref = { 0x02, func};
VECT_TO_FCT(4, my_isr)
VECT_TO_FCT(5, my_isr)
VECT_TO_FCT(6, my_isr)
Q: How can I manage public and external symbols in my project?
A: The PUBLIC and EXTERNAL assembler directives allow to share symbols (variable names, labels etc) between different assembler files.
Q: Which other assembler syntaxes are accepted by the Raisonance MA51?
A: Raisonance's MA51 accepts both the ASM-51 syntax from INTEL and the A51 syntax from Keil.
Q: The assembler seems to translate only part of my source file. What is wrong ?
A: MA51 creates only one object file for one source file. If you have assembly code in your source file plus several include files, it will always translate the last source file and ignore the other source files. Therefore, if you put e.g. an include file at the end of your source file, it will translate the include file, whereas it will translate the assembly source file if you put the include files at the beginning.
So how are all included files plus the source file translated?
Q: I Try to call a C function from assembly code, but a syntax error appears: what can I do?
A: The best is to write an equivalent C program, and to generate the SRC (select the SRC mode in "Options|Project|RC51|Object").
Q: When linking my project I obtain a message error 107 'ADDRESS SPACE OVERFLOW - Segment: ?C_XSTACK': Why?
A: This segment contains the external stack and all the 'pdata' qualified variables. This segment is limited up to 256 bytes in external RAM (xdata). Therefore you must check that the size of 'pdata' variables plus the external stack size (if you are using it) is less than 256 bytes.
Q: Our microcontroller has 20 Kbytes internal code memory, 256 bytes RAM. My problem is that I have an error message when linking: ERROR 107: ADDRESS SPACE OVERFLOW - SEGMENT: ?DT?...
I do not understand this, because my total program code is only xxx bytes, so I still have free code memory. What is going wrong?
A: The address space overflow occurs on a DATA segment (?DT?...). You have more than 128 bytes of direct addressable variables or more than 256 bytes of indirect addressable variables. There are several solutions:
Q: What does the linker error 121 'IMPROPER FIXUP' mean?
A: It means that a reference cannot be resolved by the linker.
Q: Where is the stack located in my project?
A:
Q: How can I occupy fixed positions in memory?
A: For a variable declaration, use the keyword AT to specify the position in data space, e.g.:
Q: How do I relocate some functions to an absolute address?
A: Relocating ONE function is easy (using the "at" attribute in the source).
Relocating ALL functions is still easy, using the FRelocation fields under Options|Project|Linker|Relocation.
Relocating a set of functions however is tricky and requires using the "more" field under Options|Project|Linker with a syntax that you can see in the picture. Note that you must take the module/function names from the map file (View|Map report from the linker), because they are different from what you call the same function in your source, and that those names might change if you change important parameters for the fucntion (example reentrant/not reentrant).
Q: What does the startup code do? Do I need it? How can I modify it?
A: This note will tell you everything there is to know about 8051 startup code for Raisonance tools.
What is the startup code?
From the RC51 manual: The Startup Code contains initializations needed to make your C program work correctly. It is executed at power-up and, when finished, it jumps to the “main” function of your application. An appropriate version of the startup code (depending on some parameters like memory model and others) is linked with the rest of the application when the “main” symbol is found by the compiler and performs a variety of initialization tasks including:
The Startup Code is written in assembler and can be found in the file ride\inc\sources\8051\rc51\startup.a51. It is recommended not to modify this file; if you need a specific initialization for your project we suggest you perform it at the beginning of the “main” function.
Do I need it?
If you are programming in C you definitely need the startup code in 99% of the cases (there could be exceptions, for example for modules that are not executed at power up, but rather called by other modules)
The standard startup code is included by the linker when the main() symbol is found (therefore, an easy way to avoid the startup code is to write a program without main() function), and works well for most cases (different chips, different HW configurations, different tools options), but, in some cases, you might want to extend or modify the startup code as explained below.
How is the startup code managed in Ride7?
Starting around BN729 (second half of 2002), Ride7 offers 3 different possibilities to manage the startup code, (note that the Startup Options are part of the Linker options, even if there is also 1 option in the compiler that can affect startup code).
"Default Startup" Option: The default option is "Default Startup" (shown in the picture above). When you check this option, the linker will do the following:
This approach is the safest and is also pretty well optimized, but, in some cases, you might need extended startup functionality: in this case you can use one of the two options below.
"User Defined Startup" option: Use this option when the startup code you need is totally different from what is provided by default with Ride7. When you use this option, the linker will simply not include any startup code (exactly the same as if your application contains no main() function): it's up to you to manually add a node in the project tree that contains some startup code. Note that, if you just take whatever C program and try out this option without adding a properly working startup code of your own, you will not even be able to start the debug session, as there will be no reset vector (a random part of your code will be put at address 0 and the stack will not be initialized behavior).
If you program in C, your specific startup code will need to do most of the things that are done by the standard startup anyway, so we suggest you use the method described below instead, but this option is left for cases where no startup altogther is needed (for example, as already mentioned, to compile a set of routines that will be launched by some other program)
"Micro-Specific Startup" option: Use this option when the startup code you need is basically the standard one, plus some micro-specific initialization (typically for HW features, such as buses, configuration bytes or peripherals). When you use this option, Ride7 will do the following:
Note that, some of the startup customizations that are done via the Ride7 interface (example: Initialized RAM size) or automatically (example: way used to address >256 bytes of XDATA) are not taken into account here: you need to do everything manually by editing the startup.a51 file.
Micro dependencies: initialized Xdata variables of more than 256 bytes.
The startup code is usually not too dependent on the particular 8051 derivative choosen, in that most of the micro specific features (usually peripherals) can be initialized in the main application, but there are some exceptions to this rule, including some SFRs initialization that must be done before accessing memory (example of the uPSD, this is managed by Ride7 by automatically prefilling the "Micro-specific Initialization code" field) and accessing XDATA variables over the first 256 bytes.
Note first that the startup code only needs to access XDATA over 256 bytes if you have more than 256 bytes of initialized XDATA variables in your application: this is quite rare, but in case it happens you need to read the following.
Different 8051 derivatives implement different ways of accessing XDATA memory over 256 bytes: typically this is accomplished by using P2 as the high byte of the address, but some derivatives (especially those with internal XRAM) use different SFRs for this. The startup code is written to be as compact as possible, and will therefore try to intialize the XRAM memory using the MOVX @Ri instruction, but this does not work over 256 bytes when P2 is not used: in this last case the XRAM must be initialized using the MOVX @DPTR instruction.
When using the "Default Startup" option, the linker chooses which addressing mode to use according to the value of the option "Component with XRAM".
When using the "Micro-Specific Startup" option, you must edit the startup file if you need to initialize the XDATA variable >256 bytes (look for INTERNAL_XRAM_LIKE_8xC592 in the startup.a51).
Q: How can I use TI's downloader together with Ride7?
A: TI's downloader is a piece of software provided by TI with the MSC evaluation board, that allows you to load a hex file into the memory of the MSC chip that is on the board, and then execute it without any debug functionality.
In the first steps of your application you usually don't need the downloader: when you start a debug session with Ride7, and the MSC board is selected as the debug target (picture below), Ride7 automatically downloads your application to the board (+ everything needed for debug, typically the ROM monitor).
The downloader is typically useful when your debugging is nearly finished and you want to run your "real" application, without the control of (and any interference from) Ride7.
The TI downloader can be configured to work in conjunction with Ride7 in 3 different ways:
Note that, as the only purpose of the downloder is to download your application to the board without any debugging functionality, once the download is done, all you have to do is reset the board and see if it works as you expect. In view of this, the three ways of using the downloader presented above are largely equivalent, apart that, for the first and the last, you have to take action to execute the downloader, while the second way executes it automatically (but that also means that it may execute it when you don't want it to, thus wasting time and shortening the life of the onchip Flash memory).
Whichever way you want to use the downloader, you must first install it using TI's installation program and then configure the downloader as a Ride7 external tool: this configuration is typically needed only once (if you check the "register for the application" button as explained below).
To configure the downloader follow these steps:
Now the loader is configured. You can manually call it any time using the Tools|Run Tool.. menu, or by selecting it as the debug target and then starting the debugger. If you want the loader to be executed automatically after the linker, proceed as follows:
Note that, if you follow this procedure and then go back to normal debugging using Ride7 without unchecking the button, the application will be loaded twice for every debug session (once by the loader, the other by Ride7): this is a waste of time and risks to shorten the life of the flash memory inside the device.
Generally speaking, a ROM monitor is a piece of code that allows (limited) debugging of the application loaded on the EVM or DAQ board.
In the case of these specific boards, most of the ROM monitor is already on the board (stored in the non volatile memory of the chip); Raisonance tools will only add to your application a few functions that are needed to link with this monitor.
Two things to keep in mind when using this ROM monitor;
Q: What to pay attention to when using interrupts already used by the ROM monitor?
A: If your application uses some interrupts already used by the ROM monitor, you have to pay attention to two points:
Q: After programming our MSC1210 (EVM Board from TI) with the included emulator, we cannot access the Boot ROM routines. In simulation mode everything works fine.
A: When using the emulation mode, do NOT call the autobaud routine.
Ride7 modifies the executable to execute an autobaud at reset. Therefore, your "autobaud" call could break the monitor state.
However, you can call the other (programming) functions.
Overview of the scheduler operation
Q: How does the scheduler work ? It appears that some tasks never gets executed, why ?
A: You might expect that, when you create a simple application with two tasks of the same priority, the scheduler will automatically manage to execute both alternatively, but this is not the case: because the KR scheduler is specific for real time applications, each task must take the initiative to 'give the CPU up' to other tasks, by putting itself in a state that causes the scheduler to reschedule the tasks (for example by calling a timeout, or by entering in a wait state for a signal or for a resource - see the documentation for the detailed list).
Note that, because the main() of your program is like a task of the lowest possible priority, if you create your tasks in the main and the first task you create never gives up the cpu, the other tasks (whatever their priority with respect to the first created), never get created at all.
Debugging applications containing PLM51 source code
Q: Can I debug applications including PLM/51 source code with Ride7 ?
A: Yes. For this Ride7 needs an absolute object file (OE format) of the PLM modules. Raisonance has developed a converter which converts the standard object file (in OMF-51 format produced by the PLM51 compiler) to the OE format. From Ride7, you should create a tool that invokes an MS-DOS batch file (see picture).
The batch file should look like the following:
plm51 program.p51 DB
omf2oe.exe program.obj lst(program.lst)
copy program.obj program.ob1
copy program.out program.obj
The PLM51 object node of the project is associated with the tool created above.
In the debugger, the source debugging process of PLM51 modules will be done with the .LST file.
Q: Is it possible to use DISCOVERKIT-51 or RACK-51 under MS-DOS or Windows 3.1X?
A:
Q: Can I use P0 and P2 of the microcontroller as I/O ports with the XEVA board ?
A: The XEVA evaluation board is a ROM-less mode target. The P0 and P2 are address/data buses to access the external EPROM and RAM.
In the downloading mode (with a terminal) and monitoring mode (with MONITOR-51), it is not possible to use P0 and P2 as I/O for your application.
For an industrial application purpose (OEM), you can use P0 and P2 as I/O ports. In this case :
In this mode, no downloading or debugging facilities are available.
Q: Is it possible to use INT0 and INT1 in my application with XEVA ?
A:
Q: (DISCOVERKIT-51, XEVA, RACK-51) With XEVA, can I use the internal UART of the 8051 derivative for my own application ?
A: When you use an XEVA with a 8051 derivative alone, you do not have any external UART for downloading the code or monitoring. You have to use the internal UART.
If you use an XEVA with a Terminal or Hyper-terminal (you download your application code), you can use the internal UART for your application, after the GO command.
If you use an XEVA controlled from Ride7 with the monitor option active, you cannot use the internal UART for your own application as the monitor always communicates with the PC during all debugging processes.
In order to free the internal UART, the XEVA-DEMO V2 board has been developed, which includes an external UART. This board is supplied with the DISCOVERKIT-51 set.
Q: I cannot communicate with the XEVA board (through the terminal or the Windows integrated ROM-Monitor). What can be the reason?
A: The reasons for a communication error can be multiple:
Attention! : Before starting a debugging session, please reset your hardware (XEVA or RACK-51).
Q: (XEVA, DISCOVERKIT-51, RACK-51) When using MONITOR-51 with the XEVA evaluation board, what are the restrictions ?
A: The MONITOR-51 includes libraries which are linked with your application. The MONITOR-51 functions manage the XEVA board, under the Windows Ride7 and allow debugging facilities like breakpoints, step-by-step, etc...
These libraries are relocated by the linker, and need some resources in order to work, in the CODE, XDATA, DATA and SFR spaces of the microcontroller.
Restrictions :
Q: (DISCOVERKIT-51, XEVA, RACK-51) How can I replace the TELEXEVA EPROM of an XEVA with my own application program ?
A: To replace the TELEXEVA EPROM with your own code, you have to:
Your application is then ready to run.
Q: (XEVA DISCOVERKIT-51) What is the standard configuration for XEVA with TELEXEVA V3.00 ?
A: TELEXEVA V3.00 has been developed for the new XEVA-DEMO V2 board that includes an external UART.
The standard configuration of XEVA without XEVA-DEMO V2 is:
The standard configuration of XEVA with XEVA-DEMO V2 (DISCOVERKIT-51) is:
Q: (XEVA, DISCOVERKIT-51, RACK-51) What is the standard configuration of XEVA with TELEXEVA V3.02 ?
A: TELEXEVA V3.02 has been developed for the RACK-51 set and is also supplied with XEVA and DISCOVERKIT-51 sets.
New V3.02 features are:
Q: What are the revisions of the TELEXEVA EPROM of the XEVA board ?
A: The revisions of TELEXEVA software concern both the EPROM and the PLD in the XEVA board.
TELEXEVA V1.00 : First stage of TELEXEVA : includes a down-loading program for Terminal and Hyper-terminal. Does not include facilities for MONITOR-51.
TELEXEVA V2.1 : Includes 8051, 8051-XA and 80C251 down-loading and MONITOR-51/XA/251 facilities.
TELEXEVA V3.00 : Release of V2.1. Includes management of the External UART for communication.
TELEXEVA V3.02 : Includes new selection of peripheral addresses useful for the RACK-51 set.
Upon request you may obtain a copy of TELEXEVA V3.00 free.
Q: Does the XEVA support 80C51XA derivatives ?
A: The high speed version of the XEVA called XEVA-FAST, supports some 80C51XA derivatives with special adapters :
The DISCOVERKIT-XA set allows development of XA applications with the XEVA-FAST board and includes an integrated ROM-Monitor.
The new XA-C3 is not supported because it does not allow 8-bit mode for the address bus. It will be supported in the future with the XEVA-16 board (16-bit evaluation board).
Q: Why CodeCompressor? Can't you just optimize the compiler better?
A: CodeCompressor does something the compiler cannot do, because it has an overall view of the application (C code, Assembler code, libraries and whatever else might be included) that the compiler cannot have because it works on one source file at a time.
That's why CodeCompressor always reduces the code size, even when used with a highly optimizing compiler.
Note that most of the compression techniques used by CodeCompressor are already used by the compiler (example: factorization): it's just that the scope of the optimization is different.
Q: How do I start the CodeCompressor ?
A: CodeCompressor is started by clicking on the compressor icon in the icons bar. For CodeCompressor to work properly make sure that the 'Generate PostOptimizing information' box is checked in Project ¦ Target.
Q: How do I use CodeCompressor in Interactive mode ?
A: To use CodeCompressor in interactive mode you must check the 'Interactive' box in Options¦Project¦CodeCompressor¦General.
Once this box is checked, when you click on the compressor icon, CodeCompressor is started in an interactive mode: a CodeCompressor window is automatically displayed that guides you through the possible optimizations.
Note that once optimizations have been performed, you will debug the optimized code: this means you will have reduced features for single step and variable watch/inspection, because some debug information is lost in the compression process.
Q: How do I use CodeCompressor in Automatic mode ?
A: To use CodeCompressor in automatic mode you must check the 'Automatic' box in Options¦Project¦CodeCompressor¦General. In the same menu you must choose which of the possible optimizations you want to perform (usually all of them, to get the best compression).
Once this box is checked, when you click on the compressor icon, your project is rebuilt and compressed according to the options you selected. The result of the compression is saved as project_name_CC in .aof/.bin/.hex format according to the options you selected in Options¦Project¦CodeCompressor¦Save.
Note that, when you start debugging, the uncompressed version of the project is loaded: this is because the compressed version has limited debug information in it and therefore is not intended for debug. If, for any reason, you want to debug the compressed version directly, you should use the Interactive mode.
Q: Does a demo version of CodeCompressor exist? What are its limitations?
A: A demo version of CodeCompressor is included with the demo version of 8051 development tools available for free download at www.raisonance.com.
CodeCompressor is limited in that you can compress the code but you can't save it.
Q: Is it possible to use CodeCompressor with the Keil compiler/other 8051 compilers?
A: No. CodeCompressor needs special information to work (example: distinction between code and constants) that is generated only by the Raisonance toolchain.
Note however, that, because the Raisonance compiler is compatible with C51 it is quite easy to recompile existing sources with the Raisonance toolchain and to compress them afterwards.
__________________________________________________________________________________________________
Q: My application is sligthly bigger than 64 Kb: can I compress it and see if it becomes <64Kb ?
A: You need a workaround here, because, if the application is >64Kb, the linker will generate an error and will not allow you to run CodeCompressor.
The workaround is as follows:
This procedure is quite complex, but it is, at present, the only way to compress a program from >64K to <64K.
Q: I get the "Undefined Blocks" error and CodeCompressor does not work. Why?
A: "Undefined Blocks" means that the CodeCompressor is missing some important information about the code to be compressed and therefore cannot do its work.
Possible causes are:
Q: Can I emulate Atmel microcontrollers with PCE-5130C and RPD-HK500 ?
A: The answer depends on the application and the microcontroller:
Q: Can I start the emulator with my target, without loading any application program?
A: Yes, this mode is interesting if you want to debug your hardware. The following procedure starts the emulator without a program :
In the debugging mode, you will be able to write the assembler mnemonic directly in the Code Window ('View | Code (disassembly)'), and execute the written code with 'Run' and step by step commands. All the peripherals and sfr can be accessed and modified in the monitor mode of the emulator.
Warning!:
Q: Can I emulate a low voltage application with PCE-5130C ?
A: Low voltage applications (3V3 +/- 10%) can be emulated with :
Q: Can I emulate the Philips P8XC51RA+/RB+/RC+/RD+ microcontroller including the flash version (P89) with the Raisonance emulator?
A: Yes, you need a PCE-5130C associated with pod RPD-HK500 and adapter ADP-HK501.
In order to replace the emulation MPU on the ADP-HK501's PLCC-44 socket, you need the following reference: PHILIPS P87C51RD+4A for an application frequency from 1 to 12 MHz or
P87C51RD+IA for an application frequency > 12 MHz.
Q: I have communication errors with PCE-5130C. What can the reasons be?
A: There can be many reasons:
Q: What is the maximum frequency accepted by the RPD-HK500 ?
A: The maximum frequency depends on 2 factors :
Q: I have the message : "Int. oscillator error : 0.6 MHz". Why does my PCE-5130C emulator not start correctly?
A: If you are using the clock on your target board for the emulator, verify that your microprocessor itself has a suitable clock source (voltage, frequency, and rise/fall-times). You should also verify that the jumper settings on the pod emulator select this as the clock source.
Please also verify your debugging options. This error message can occur if you have not selected the right pod. (See 'Options | Debug | Advanced Options | Pod Selection' under Ride7. Before selecting 'Advanced Options', you must have selected 'Real Machine (Emulator or ROM-Monitor)' under 'Tool' along with 'PCE-5130C' under 'Real Machine'.)
Q: With the PCE-5130C connected to the target, my application works fine. When I load/burn the code into the microcontroller/EPROM, and I try to run the application without the emulator, it does not work properly. What can the reasons be?
A: This problem can occur for many reasons :
Q: The application works properly with a code EPROM or the 'burned' embedded microcontroller, but not with the emulator. What can the reason(s) be?
A: This situation can have multiple causes :
Q: What is the right way to switch the emulator and the target application on and off?
A: When the emulator is connected to a target application, care must be taken to power on and off the system in the right order:
If you do not respect this process, you can damage the target and/or the emulator.
Q: Why does the instruction MOVX not run properly with the RPD-HK500 probe and the 80C32 microcontroller ?
A: The MOVX instruction makes an access (read or write) in the external RAM, or peripheral within the target, via the external bus P0 (A0-07, D0-D7), P2 (A8-A15), and also P3.6 (/WR) and P3.7 (/RD).
Q: Why does the emulator detect another pod (or MCU) on 'start debug'?
A: The error on pod is detected with the error "message A POD different than specified has been detected!", which occurs on start debug.
The error on MCU is seen after the start debug, opening the View| Debug Report
If the pod is not detected , please check:
If the MCU is not detected , please check:
Q: Why does the PCE-5130C not work in embedded ROM mode with the RPD-HK500? Why am I not able to use P0 and/or P2 as I/O ports?
A: The reasons why P0/P2 are not able to be I/O can be caused by a number of reasons:
Q: The timer 2 of the Siemens C508 does not count correctly.
A: This problem has been encountered with some oscillators. Try a different oscillator.
Q: Can I emulate Dallas derivatives? What are the restrictions?
A: You can emulate some DALLAS derivatives :
DS80C310 / DS80C320 : With RPD-31F (max freq. 33 MHz) or with RPD-HK500 (max freq. 25 MHz).
DS80C323 : With RPD-31L (max freq. 16 MHz).
DS87C520 : In ROM-less emulation mode with RPD-31F (max freq. 33 MHz) or with RPD-HK500 (max freq. 25 MHz).
DS80C390: can be emulated.
Q: Am I allowed to exercise software control of the ALE signal on the PCE-5130C?
A: Some derivatives of the 8051 allow to control the ALE signal by software, in order to reduce EMI. A special register turns off the ALE signal.
This action on the ALE signal is inappropriate with the PCE-5130C, because this signal is needed for the emulation.
Q: Is it possible to measure the duration of an external signal with PCE-5130C/40C?
A: Yes. You must use a wire of one of the probes connected to either PortA or PortB on the PCE5130C/40C, together with the trace.
Emulation of the ATMEL T89C51RD2 (40 or 44 pins).
Q: Can I emulate the Atmel T89C51RD2 with PCE-5130C/PCE-5140C and RPD-HK500 ?
A: The answer depends on the application :
The frequency limitation is due to the RPD-HK500 and the PHILIPS emulation mode : 20 MHz in 12 clock mode, and 12 MHz in 6 clock mode.
Q: What are the features & limitations with emulation of X2 derivatives with PCE-5130C/5140C and RPD-HK500 ?
A: There are more and more X2 derivatives in the 8051 market.
This technique consists in surpressing the clock pre-scaler within the 8051 core.
The 12 clock per machine initial cycle operation is moving to 6 clock per machine cycle operation, with the X2 mode.
The manufacturers have different ways to implement this feature:
PCE-5130C-5140C configuration :
The emulation options differ with the emulation mode and component family :
Limitations with PCE-5130C/5140C : Some restrictions exist when using the X2 mode.
Q: Can I easily make my own oscillator, for emulation needs, when the frequency value is not available in the components market ?
A: Why an oscillator is better: The emulator is synchronised with the clock signal which can be (depending on the pod configuration ) :
We can easily understand that the target crystal configuration is the worst : The clock signal coming from a crystal has a bad signal/noise ratio. It is disturbed by other target signals, bad grounds, power supplies, etc..
Its only advantage is that the emulation frequency will be the same as target frequency.
When it is possible, and in the following cases, it is much better to use the “Internal on XT1” configuration :
It is necessary to use the “Internal on XT1” configuration in the following case :
How to use the internal oscillator ?
The supplied oscillator is clocked 12 MHz or 16 MHz.
To use the internal oscillator as clock source :
- Configure the pod for “Internal on XT1” (see pod reference manual).
- If necessary, change the oscillator for the same frequency as your target crystal. If you don’t find available the good frequency, you can make your own oscillator (see above).
How to make your own oscillator ?
If you have a non-standard frequency on your target, you will have to make your own oscillator.
2 examples are given in the “PHILIPS 74HC/HCT4060 14-stage binary counter with oscillator” data sheet (See below figures 10 & 11). For further details, download the complete data sheet :
http://www.philipslogic.com/products/hc/pdf/74hc4060.pdf
***********************************************************************************
| |
|
***********************************************************************************
Q: How can I extend the emulation memory of the PCE from 128 Kb (default) to 512 Kb?
A: In its standard configuration, the PCE-5140C emulator is supplied with 128 Kb of code memory. This capacity can be extended to 512 Kb by the user. To extend the addressable space from 128 Kb to 512 Kb, operate as follows:
No software configuration is necessary.
Note about SRAM for memory extension: The SRAM has the following features :
Manufacturer reference (examples):
Q: Can I emulate a page mode architecture with PCE-5130C-5140C ?
A: In this architecture, external data memory addresses are one byte wide (using P0).
P2 (or a part of) is optionally used as I/O lines, to page the RAM, as shown in the following figure 5 (taken in the PHILIPS Data Handbook IC20) :
Access to the external RAM, uses the movx @ri,A or movx A,@Ri in assembler and pdata qualifier for variables in C language, that affect only P0 , /WR and /RD signals.
Emulation: Page mode architecture emulation is possible only with the Siemens C500 setting of RPD-HK500 options. You must :
Emulation MCU: With an ADP-HK501, choose the INFINEON SAB-C513AO-LN (superset of 80C32/52) or SAB-C501G-LN (discontinued) or SAB-C501G-L24N (discontinued).
Q: Can I emulate Flash derivatives with PCE-5130C-5140C?
A:
ISP interface
The PCE-5130C-5140C can emulate such derivatives, but the ISP (In system Programming) is not supported. During emulation, all routines using ISP will not work properly.
(The reason is that the application code, at the beginning of a debugging session, is loaded into the emulator memory, and the code is executed from this memory. Even if the Flash MCU is programmed with the application code, no access will be made to the internal code within the Flash memory.)
Embedded ROM emulation
Only Philips derivatives can be emulated properly in embedded ROM mode. That means, that P0 and P2 can be used as I/Os.
Other derivatives (ex: Atmel), can be emulated only in ROM-less mode (P0 and P2 are always bus/ data buses. However, when an Atmel derivative is very similar to a Philips derivative, you will be able to emulate it in both ROM-less and embedded ROM mode, by using the Philips MCU as the emulation component (ex : 89C51RD2)
Putting the Flash derivative as emulation MCU
When you put a Flash derivative (89Cxx) on the emulation MCU socket (ex : ADP-HK501), make sure that this component is not blank. Flash components are supplied in a special mode where, at reset, an internal boot loader is accessed (typically located at 0xFC00 of the code space). This mode allows programming the Flash memory with the ISP but is not compatible with emulation process, that needs to boot at the address 0x0000. Programming the MCU (any program will be convenient), makes the MCU start code access at 0x0000.
Q: How can I connect my Raisonance emulator to a PC with no serial port (or with serial port problems)?
A: A USB to Serial converter exists that can be successfully used to connect the emulator to the PC.
This is of course useful for the smaller PCs without any serial port, but it can also be used for PCs whose serial port does not work well with Ride7 (the latest Dells have some sort of polling on the serial port that interferes with Ride7).
USB to serial adapters usually come with a driver that creates a virtual COM port (usually COM3 or COM4) that can be selected in Ride7. The reference "USB to Serial Adapter cable ref : DA 70119" from Assmann has been tested and is guaranteed to work.