HC08: new user of codewarrior

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

HC08: new user of codewarrior

Jump to solution
3,914 Views
jcuesta
Contributor I

HI, this is my first day working with codewarrior and its the first time i found an understandable problem... although supose it will not be the last :smileyhappy:.

I was trying to develop a very simple program in wich i try to load a program into a development board and execute it, the program only pretend to initialice the Uart and send some simple message to the computer, here it is:

#include <hidef.h> /* for EnableInterrupts macro */

#include "Uart.h" /*UART functions*/

void main(void) {

uint8 contador=0;

EnableInterrupts; /* enable interrupts */

/* include your code here */

 

Uart_init(); /*Uart inicialization*/

 

Uart_Print("Hello word!!!.\n\n");

 

/*going to try something a bit more complex*/

 

for(;:smileywink:{

 

Timer_Reset();

// Wait until timer has reached a certain value

while(Timer_Get() < 20) {}

Uart_Print("still here\n");

}

 

/*never get here*/

 

for(;:smileywink: {

__RESET_WATCHDOG(); /* feeds the dog */

} /* loop forever */

/* please make sure that you never leave main */

}

The problem is that after adding all .h that were requested by the UART.h (i took them from an example of yours) and compiling the program it gives an error "expected ; in line 132 of Uart.h"

I didnt touched that function and it seems to compile well in your example, im assuming that im missing something before including that library but i have no clue what could it be, maybe i forgot something basic and you can help me with it.

Thanks for your time.

Message Edited by CrasyCat on 2007-04-13 01:54 PM

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,152 Views
J2MEJediMaster
Specialist I
The illegal BP message indicates that the program has jumped off into the weeds in memory and is trying to execute the random data there as instructions. Often such data happens to resemble a breakpoint instruction, and so the processor stops and the debuggers seizes the helm. One cause of such a jump to nowhere can occur if you've not set up your interrupt vector table properly, or some other device is firing a spurious interrupt.

Have you tried looking in the (Help) directory? That is where most of the CW documents reside. Also, it's possible one of the example programs you tried has UART initialization code you can adapt for your program.

As a final suggestion, looking at your code, I'd not enable interrupts until after you initialize the UART. You want all of your peripherals configured and in known state before you switch on interrupt processing.

---Tom

Message Edited by J2MEJediMaster on 2006-09-22 09:09 AM

View solution in original post

0 Kudos
8 Replies
1,152 Views
J2MEJediMaster
Specialist I
What is the board/processor you're targeting?

What version of Codewarrior are you using?

What is on line 132 of UART.h?

Have you tried building one of th example programs yet?

---Tom
0 Kudos
1,152 Views
jcuesta
Contributor I
Hi, first of all thanks for your help, i finally found the problem but anyway i'll answer your questions after explaining what i found. The problem was that I wrote Uart_init instead of Uart_Init, what i cant understand is why the compiler didnt said me something like "function doesnt exists" or something like that, after changing it the program compiles and im able to acces the debugger, load the program and run it but when doing it i got no messages from the UART to the computer and got this message in the debbuger: "STARTED RUNNING Frequency change to ~0hz. Frequency change to ~4025088hz. ILLEGAL_BP in>" Im assuming ILLEGAL_BP means ilegal breack point althuogh there is no breack point in the program... im quite confused about how codewarrior works and his error messages. - Im using MC13213-SRB for running the program and DEM09S08QG8 for loading the program into the MC following our supplier instructions "EBW elektronik". - Code warrior version: 5.7.0 - The line 132 of uart.h is the first one of the following: "uint8_t Uart_Poll ( uint8_t * pBuffer // Data from the UART is copied to this location );" - Yes i have tried to build some of the example programs and they compiled and runned properly in teh debbuger. As a size note, I have lot of documentation about codewarrior and info on how to use it but none of them has a very detailed information on the program I expected to have something called like "CodeWarrior User Manual" or something like that but I dont have that document within my documentation, ¿that document exists?, have searched though the files system of freescale and althugh i didnt opened all of them there were none that had any name similar to the one i was expecting. Im sorry for asking so "newbie" questions, hope to get used to the program soon.
0 Kudos
1,152 Views
jcuesta
Contributor I
Hi, first of all thanks for your help, i finally found the problem but anyway i'll answer your questions after explaining what i found.

The problem was that I wrote Uart_init instead of Uart_Init, what i cant understand is why the compiler didnt said me something like "function doesnt exists" or something like that, after changing it the program compiles and im able to acces the debugger, load the program and run it but when doing it i got no messages from the UART to the computer and got this message in the debbuger:

"STARTED RUNNING Frequency change to ~0hz. Frequency change to ~4025088hz. ILLEGAL_BP in>"

Im assuming ILLEGAL_BP means ilegal breack point althuogh there is no breack point in the program... im quite confused about how codewarrior works and his error messages.

- Im using MC13213-SRB for running the program and DEM09S08QG8 for loading the program into the MC following our supplier instructions "EBW elektronik".

- Code warrior version: 5.7.0 - The line 132 of uart.h is the first one of the following:

"uint8_t Uart_Poll ( uint8_t * pBuffer // Data from the UART is copied to this location );"

- Yes i have tried to build some of the example programs and they compiled and runned properly in teh debbuger.


As a size note, I have lot of documentation about codewarrior and info on how to use it but none of them has a very detailed information on the program I expected to have something called like "CodeWarrior User Manual" or something like that but I dont have that document within my documentation, ¿that document exists?, have searched though the files system of freescale and althugh i didnt opened all of them there were none that had any name similar to the one i was expecting. Im sorry for asking so "newbie" questions, hope to get used to the program soon.
0 Kudos
1,153 Views
J2MEJediMaster
Specialist I
The illegal BP message indicates that the program has jumped off into the weeds in memory and is trying to execute the random data there as instructions. Often such data happens to resemble a breakpoint instruction, and so the processor stops and the debuggers seizes the helm. One cause of such a jump to nowhere can occur if you've not set up your interrupt vector table properly, or some other device is firing a spurious interrupt.

Have you tried looking in the (Help) directory? That is where most of the CW documents reside. Also, it's possible one of the example programs you tried has UART initialization code you can adapt for your program.

As a final suggestion, looking at your code, I'd not enable interrupts until after you initialize the UART. You want all of your peripherals configured and in known state before you switch on interrupt processing.

---Tom

Message Edited by J2MEJediMaster on 2006-09-22 09:09 AM

0 Kudos
1,152 Views
jcuesta
Contributor I
Thanks again for your help, i solved that problem but im still unable to compile and debug my aplication although i think im "almost there".
 
When i finally solved that problem my program compiled but while debuging it did nothing, (I loaded the program withouth problem but after running it the UART sent no info to the computer, also it never ended the execution), after checking your example (Mystarnetworkapp end device) I suposed (correct me if im wrong) that my problem is that i didnt initialiced Msg_Initqueue so i did it leaving my program as it is now:
 
-----------------------------------------------------------------------------------------------------------------------------------------
 
#include <hidef.h> /* for EnableInterrupts macro *//*not needed*/
#include "802_15_4.h"
#include "Uart.h"     /* Defines the interface of the demo UART. */
#include "msgsystem.h"
 
 
anchor_t mMlmeNwkInputQueue;
anchor_t mMcpsNwkInputQueue;
void main(void) {
 
int i=0;
 
   
 /* include your code here */
 
 MSG_InitQueue(&mMlmeNwkInputQueue);
 MSG_InitQueue(&mMcpsNwkInputQueue);
 
 Uart_Init();     
  
     
 Uart_Print("Hello word!!!.\n\n");
  
    
 i=i+1; /*this is only for checking variable value change in the debugger*/
  
 
}
 
-----------------------------------------------------------------------------------------------------------------------------------------
 
The problem is that now the program doesnt link properly, after clicking on "make" the codewarrior returns the following error: "L1822:List_Clearanchor in file c:zigbee/hola_mundo2/hola_mundo2_data/standard/objectcode/main.c.o in undefined" I have cheked the help in the help system but it doesnt helped me in any way since nor the NAMES or the PATH that is mentioned there is used in my functions or in the functions in your example.
 
"list_clearanchor" is defined in both my application and yours in MsgSystem.h.
 
Thanks in advance for any help you can give me regarding this problem
0 Kudos
1,152 Views
jcuesta
Contributor I
Hi all again,
 
 
I was able to solve that problem, was unable to find where was that function was defined so i added the .lib in your example to my program and it worked.
 
Now for some reason, the program compile and dont give any error but the UART doesnt writte anything, the code is the same as above, and debugging it and running it steep by steep the prorgam executes correctly but the computer doesnt recive anything when Uart_Print("...") executes.
 
My question is, ¿is there any other kind of inicialization for the Uart sending info? you can check the code in the last post.
 
thanks for your time.
0 Kudos
1,152 Views
J2MEJediMaster
Specialist I
1) Are you sure that you've set up the baud rate correctly for the UART? Is the PC terminal program using the same baud rate? And you've seen output from one of the Freescale demo programs appear on the PC, so you know the connection is good?

2) Have you tried placing breakpoints in the undefined interrupt and the COP interrupt routines to see if a spurious interrupt or a COP timeout is tripping up the program when you just let it run?

---Tom
0 Kudos
1,152 Views
jcuesta
Contributor I
HI and thanks for your help again :smileyhappy:.
 
well... yes, im more or less sure, as sure as could be someone that started with codewarrior a few days ago... the Uart_Init should do it, im ussing the code in Uart.c of one of your examples and I know the baud rate selected was 19200, anyway for being sure i added this lines:
 
/* include your code here */
 
 MSG_InitQueue(&mMlmeNwkInputQueue);
 MSG_InitQueue(&mMcpsNwkInputQueue);
 
 Uart_Init(); /*inicializamos la UART, para poder mandar y recibir mensajes*/
  
//lines added 
 SCIXBDH = 0x00;
  SCIXBDL = 0x1a;
//end of added lines
 EnableInterrupts;
    
 Uart_Print("Hola\n\n");
 
I think that should be enough for setting my comunication parameters.
 
I Yes I have tried the freescale demo programs and they worked so the connections seems ok.
 
And well i didnt placed breackpoints but executed the program line by line, i also looked into the Uart_Print function and it takes the letters one by one from the string when in the apropiate line of the code but my computer doesnt recive anything.
 
Im not absolutelly sure of whats needed to configure the Uart, im going to take alook to the forums now that you mentioned that could be the problem but if anyone can leave me here any info on if those 2 lines are enough or not to configure it would be great, thanks.
0 Kudos