Hallo ,everyone!
I have just working with Matlab RTW and Keil IDE for the code development of Infineon XC164CS. The idea is so: with the environment of MATLAB/Simulink I can model, then use RTW for code generation. Here I use Embedded Target for OSEK/VDX, and I have developed the blocks for XC164 hw driver using the S-Function mechanism. And based on the open source uc/os II for xc164, I can compile the generated codes from RTW together with uc/os II. Complicated? By now I have finished the most parts of the job. The problem is, after compiling and linking (without Errors and Warnings), I get ever the following error message from Keil IDE under debug mode. *** error 65: access violation: addr=0x00C00004
The souce codes is as following (Predigestion has been done for easy checking): I wonder, if I can attach the project file.
Thanks for tips
in file main.c
/* * Auto generated OSEK main program for model: osek_empty1 * * Real-Time Workshop file version : 5.1 $Date: 2003/08/08 18:37:24 $ * Real-Time Workshop file generated on : Thu Dec 18 09:00:00 2008 * C source code generated on : Thu Dec 18 09:00:00 2008 * * Description: * OSEK target top-level, osek_empty1.c. * */ /* Model's headers */ #include "osek_empty1.h" #include "osek_empty1_private.h" #include "main.h" /* Using RTW singletasking execution of model */ OS_STK a[10]; OS_STK b[10]; extern void GPT1_vInit(void); void main(void) { OSInit(); GPT1_vInit(); osek_empty1_initialize(1); OSTaskCreate(InitA, (void*)0, &a[9],10); OSTaskCreate(InitB, (void*)0, &b[9],11); OSStart(); }
in file model.c
/* * Real-Time Workshop code generation for Simulink model "osek_empty1.mdl". * * Model Version : 1.69 * Real-Time Workshop file version : 5.1 $Date: 2003/08/08 18:37:24 $ * Real-Time Workshop file generated on : Thu Dec 18 09:00:00 2008 * TLC version : 5.1 (Aug 8 2003) * C source code generated on : Thu Dec 18 09:00:00 2008 */ #include "osek_empty1.h" #include "osek_empty1_private.h" #include "main.h" /* Model step function */ void osek_empty1_step(void){ /* (no output code required) */ /* (no update code required) */ } void InitA(void *pdata) { // INT8U err; pdata = pdata; while (1) { osek_empty1_initialize(1); } } void InitB(void *pdata) { // INT8U err; pdata = pdata; while (1) { osek_empty1_initialize(1); } } /* Model initialize function */ void osek_empty1_initialize(boolean_T firstTime) { if(firstTime) {;}/* (no initialization code required) */ } /* Model terminate function */ void osek_empty1_terminate(void) { /* (no terminate code required) */ } void GPT1_vInit(void) { GPT12E_T3CON = 0x0003; // load timer 3 control register GPT12E_T3 = 0x85EE; // load timer 3 register GPT12E_T2CON = 0x0000; // load timer 2 control register GPT12E_T2 = 0x9E58; // load timer 2 register } // End of function GPT1_vInit
A search for 'Error 65: Access violation' yielded this result:
http://www.keil.com/support/docs/814.htm
What is at 0x00C00004 ? It may be a register on the actual hardware that the simulator is not aware of.
If this is the case, following the instruction in that article should resolve your technical issues.
View all questions in Keil forum