CodeWarrior V8.0 and 56f8367EVM board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CodeWarrior V8.0 and 56f8367EVM board

3,464 Views
KonradC
Contributor I
Hi all, I am a student using CodeWarrior V8.0 and 56f8367EVM board to interface with the DS18S20 digital temperature sensor from Dallas Semiconductor. I am a first time user of CodeWarrior and am having trouble with a few aspects. The first problem I would like to address is using a Function in C code. I am able to define the Function prototype prior to Processor Expert initialization under the designated variable definition area, as shown in the default code generated by CodeWarrior (see NOTE 1. at end of message). Now when I try to write the function under the Write your code here area, I get expression syntax error as shown in NOTE 2. Does this mean that I have to write all the Functions prior to Processor Expert initialization along with the prototype?

As I was not able to perform function calls I turned to assembly using the jump to subroutine function JSR and RTS the commands were written in the /* Write your code here */ area and performed the jump. This solved one problem but now I had another, because every time the assembly code JSR and RTS is called all my variable values that were declared under /* Write your local variable definition here */ get completely changed to random numbers. So I tried the BRA instead of the JSR instruction which stopped unwanted changing of the variables but the Return from subroutine instruction still changed them. The variable locations as shown in the debuger start at 0x00000114 Hex. I know that for the 8052 assembly code there is an instruction ORG that declares where the program code should start, so that we don't overwrite the interrupt vectors located below 30H in the program code memory. I understand that CodeWarrior has substantially more initialization code, now my question is does my program code get written over some of this code space thus changing my variables. Is there an instruction like the one for the 8052 ORG that I should use or does CodeWarrior allocate everything automatically?

One last question in regards to PC Master or Free Master. I understand that there is a plugin for CodeWarrior to allow me to use Free Master. The Scope and Recorder would greatly ease my trouble shooting as I am able to establish sensor presence but can't get the reading from it so I have record the timing to see if there maybe any issues there. Not to mention some the other grate features like web control that I would like to experiance. I don't have the RS 232 cable but I can easily configure my own cable if anyone may know the pin-out used. I did read something about FreeMaster now using SCI instead of RS 232 so I am unsure of which direction to go. Once a cable is installed how do I start the FreeMaster software?

I know that I have a lot of questions, but if anyone can help me out with one or two them, know of any tutorials, walkthroughs or just point me in the right direction I would be very grateful.
Thanks In Advance.

NOTE 1.

/* Write your local variable definition here */

/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/

/* Write your code here */


NOTE 2.

C/C++ Error 10141

function defined 'inline' after being called

A function was declared inline after it had already been called.

int func( int x );
class cA {
int i;
public:
cA() { i = func( 3); }
};
inline int func( int x ) { return x + 1; }

Fix

Declare the function prototype to be inline
Labels (1)
Tags (1)
0 Kudos
4 Replies

439 Views
KonradC
Contributor I
Me again, In case of the FreeMaster software does the SCI still interface with the computers RS232 and once interfaced does the software initialize automatically once the PCMaster bean is added to the project.
Thanks.
0 Kudos

439 Views
GordFinlay
Contributor I
I don't know about the 56F8367 version Freemaster working with the Codewarrior for 56F8xxx Processor Expert.  But I do have the Freemaster shared platform FMASTERSCIDRV working with PE on the 9S12.
 
If the PE beans for 56F8xxx are anything like on the 9S12, I suggest using the Init_SCI peripheral initialization bean to configure the SCI properly for your board. You will have to setup up the baud rate, and other SCI parameters in the Init_SCI Bean Inspector. For interrupts, specify that SCI interrupts should be forwarded to the Freemaster FMSTR_Isr interrupt service routine. My ISR for the 9S12 is in the device specific part of the FMASTERSCIDRV in the freemaster_hc12.c module. For you, this would be in the file "C:\Program Files\Freescale\FreeMASTER Serial Communication\src_platforms\56F8xxx\freemaster_56F8xxx.c".  The linker PRM file generated by PE, and the vectors.c file should point the vectors to your FMSTR_Isr routine. For the 9S12, because I setup the interrupt routing myself in the PRM generated by PE, I have to make sure that I do not define FMSTR_SCI_INTERRUPT in the freemaster_cfg.h configuration (I comment it out where it defines the interrupt number with FMSTR_SCI_INTERRUPT).
 
For all other parts of the FMASTERSCIDRV, add the src_common\*.c and .h files and the src_platforms\56F8xxx\*.c and .h files to your project and follow the instructions in fmstrdrvum.pdf to configure your driver. One the port is configured with the Init_SCI bean, and you have the driver compiled in your app, then you should be able to set the matching baud rate in the FM client application on the PC and you are away to the races. It all should go relatively smoothly.
 
Gord Finlay
0 Kudos

439 Views
GordFinlay
Contributor I
I forgot to mention in my reply that it seems from the original post that your were trying to use the old PC Master driver with the PC_Master bean. I recommend that you ditch these and use the new and improved FMSTRSCIDRV on the target with the latest Freemaster 1.3 on the host PC. FMSTRSCIDRV does not yet have it's own bean at this stage but it is quite easy to use. Just use it with the Init_SCI bean to setup the SCI port like I mentioned , and read the driver manual - particularly section 2.6 SCI Initialization, and section 4.3 56F8xxx Digital Signal Controllers.

The FMSTRSCIDRV (FreeMASTER Serial Communication Driver) on the downloads page for FM fully replaces the former PC Master driver and PC Master Bean. The new FreeMASTER driver remains fully-compatible with the communication interface provided by the old PC Master drivers. It brings, however, many useful enhancements and optimizations.

The main advantage of the new driver is a unification across all supported Freescale processor products. Several new features were also added. One of the key features implemented in the new driver is target-side addressing (TSA), which enables an embedded application to describe memory objects it grants the host access to. By enabling the TSA-Safety option, the application memory can be protected from illegal or invalid memory accesses.

Gord

0 Kudos

439 Views
J2MEJediMaster
Specialist I
I'm not familiar with ProcessorExpert and so will defer to someone who does.

As for your assembly code: The JSR instruction is going to--at a minimum--push a return address onto the stack, and maybe some other items. If you're referencing all of your local variables as offsets in the stack, then after the JSR executes, those offsets have changed. Using a BRA instruction doesn't fiddle with the stack, so your variable references remain valid. However, you're using a return from subroutine to try to return? That instruction is going to expect to find a return address on the stack (put there by a JSR) and will adjust the stack pointer accordingly. Again, this hoses your offsets. You need use another BRA instruction or a JMP instruction at the end of the routine the make the return without changing the stack.

---Tom
0 Kudos