Can someone help me with codwarrior 5.9.0 syntax for mpc5121e processor?

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

Can someone help me with codwarrior 5.9.0 syntax for mpc5121e processor?

2,105 Views
bbjh1
Contributor I

Hi,

 

I am new with the mpc5121e processor. I am trying to write a simple program that deals with I/O. The idea of my program is that whenever SW1 is On LED 2 turns On. My problem is that I never used C code for embedded systems so I am not sure how to configure the registers. Any help is very appreciated. Thank you.

Message Edited by bbjh1 on 2010-02-11 09:56 PM
Message Edited by bbjh1 on 2010-02-11 09:57 PM
Labels (1)
0 Kudos
19 Replies

923 Views
J2MEJediMaster
Specialist I

In the CodeWarrior installation folder, there is a folder called (CodeWarrior Examples). In it are some sample programs, one which toggles LEDs. That should have enough information to get you started.

 

---Tom

0 Kudos

923 Views
bbjh1
Contributor I

Hi Tom,

 

Thank you for your reply. I have a CodeWarriorIDE folder and CodeWarrior-MGT-9.1 folder. In the first one, there is an "Examples" folder, there are "Common", "Makefiles", PowerPC_EABI" and "PPC" folders. I was not able to find in any of these folders a sample C code that deals with the LEDs on the ADS512101 board. I was wondering if you know the name of the file. Thank you very much. 

0 Kudos

923 Views
J2MEJediMaster
Specialist I

Sorry, I was looking at the Power Architecture v8 tools. I do not have the Mobile GT (MGT) version. What is in the CodeWarrior Mobile-MG-9.1 folder?

 

---Tom

0 Kudos

923 Views
bbjh1
Contributor I

Hi Tom,

 

Thank you again for your reply. In the CodeWarrior Mobile-MG-9.1 forlder, I have a CodeWarriorIDE folder that contains an Example folder. In the example folder tehre are : Common, Makefiles, PowerPC_EABI and ppc folders. None of the examples really show a sample c program that deals with the processor.

Please tell me if the steps I am doing are correct : After I connect my ADS5121 board to my linux machine, I start the codewarrior, and start an EPPC new project wizard. So I was wondering if there is any files I should include in my c code to initialize the ads board or at least I can start playing around with memory locations and registers. Like for example, can I use the IMMR register directly in my code or is there any header file that should be included or should I define the IMMR register with its default memory location.

Thank you very much for your help.

0 Kudos

923 Views
J2MEJediMaster
Specialist I

The CodeWarrior wizard generates a simple program with code stubs and has the proper header files. Have you built a program with the wizard and does it compile and run? What choices for hardware target do you see in the wizard? Usually there should be one of the board or one very similar to it that you would choose to obtain the proper header files.

 

---Tom

0 Kudos

923 Views
bbjh1
Contributor I

I followed the start guide book that came with the CW installation CD. I create an EPPC new project wizard and follow the steps and choose 52xx processor. The only header added is the standard stdio.h. So I was wondering if there is something missing. Thank you.

0 Kudos

923 Views
J2MEJediMaster
Specialist I

Now you have me stumped. You need to submit a service request to get the problem sorted out. Click here to do that.

0 Kudos

923 Views
bbjh1
Contributor I

Alright, I was able to create a project that has system_call() function but whenever I try to compile the code I get the following error,

 

" License check failed: No such feature exists

Feature: Linux Plugins_Comp_PPC

License Path License.dat

FLEXlm error : -5,357"

 

Do you know what's the problem?

 

Thx.

0 Kudos

923 Views
CrasyCat
Specialist III

Hello

 

Either your license file has expired or you do not have the appropriate license file.

 

I would recommend you to submit a service request for that.

Click here to submit a service request.

Make sure to attach your current license file to the SR..

 

 

CrasyCat

0 Kudos

923 Views
bbjh1
Contributor I

Hi,

 

Thank you for your reply. I already submitted a SR and I am still waiting for their reply. I was wondering if you can help me and tell me if I should follow the steps found in "Creating a Bare Board Project" in the Targeting mobileGT Processors.pdf to create a new project on the ADS5121 board?

 

Thank you again

0 Kudos

923 Views
CrasyCat
Specialist III

Hello

 

Well as long as you do not have a working license file, you will not be able to either build or debug anything.

 

You need to get your licensing problem fixed first.

 

CrasyCat

0 Kudos

923 Views
bbjh1
Contributor I

hey

 

The support team just sent me a license file that expires in 30 days, after that I guess I might have to purchase a full license.

 

So now, I created a bare board project but when I try to debug it the CW gives me an error that says that "cannot connect to the board" and that I have to check my connection. Here is what I did, I have my host computer and target (board) connected to a switch and I was able to ping both ips. So I am not really sure what should I do. I have attached the error. Thank you again for your help.

 

0 Kudos

923 Views
J2MEJediMaster
Specialist I

1) Make sure that the switch is not blocking the port that the debugger uses to communicate with the board. Check the Debugger settings panels to see what port it is using.

 

2) If you are using a VPN client to stay in touch with the mother ship, you need to switch that off. The VPN client is grabbing the packets and trying to forward them to your corporate intranet rather than to the board on the other port. This is especially true if pings work while other packet traffic does not. The VPN client usually ignores the ping packets.

 

---Tom

0 Kudos

923 Views
bbjh1
Contributor I

Hi Tom,

 

I connected both the board and the linux pc to a switch and also I connected the board to the pc via the null modem cable. All what I did is in uboot, I set up the ip and the netmask by setting and saving the environment . Then I created the eppc project and even for  a simple hello world c code, when I want to debug it (Project -> Debug) I get the error. I did not change anything in the debugger settings. So I am not really sure what's going on.

Thx again for your help.

0 Kudos

923 Views
J2MEJediMaster
Specialist I

I am looking back at your earlier comments. For the board you are trying to communicate with, is it running only your program, or, as you mentioned in your last post, are you trying to run Linux on the board? The bare-board CodeWarrior project choice is for debugging stand-alone programs on the board. You will need to choose another project option if you are trying to run Linux on the board.

 

---Tom

0 Kudos

923 Views
bbjh1
Contributor I

hey Tom,

 

Well I am trying to get familiar with the board, so I am trying to turn on the LED. I contacted the freescale support team they told me to follow the steps to create a bare board project. I don't think I need right now to run Linux on the board. Do you think I have the wrong connections to the board?

Thx.

0 Kudos

923 Views
J2MEJediMaster
Specialist I

Earlier you were talking about pinging the board. When you are doing a bareboard project, there's no intelligence on the board whatsoever to respond to a ping. You also need a run control probe to communicate with the board in this situation. Maybe you are using EtherTAP? How exactly are you connecting to the board?

 

---Tom

0 Kudos

923 Views
bbjh1
Contributor I

Hi Tom,

 

Honestly,  when I first contacted the freescale support team, they told me I should create a bare board project, but apparently this is the wrong process. All what I have is a null modem serial cable, I don't have the EtherTAP or USB Tap, so I need to connect to the board through Apptrk. I followed the steps in the section "using apptrk" in the CodeWarrior TRK Reference.pdf,  I connected the board to my computer through the null modem, and I connected the board to a switch with an Ethernet cable. I created a new EPPC project. After doing all the steps, I have main.c (Hello world) file, I was able to debug it normally. But if I want to access any memory location, the debugger prevents from doing so, I don't know if tehre is anything missing.

Like for example, I have the following code,

 

#include <stdio.h>
#include <stdint.h>
typedef unsigned char uint8;
typedef unsigned int uint32;

uint32 sl1;

int main()
{

 

  printf("Welcome to CodeWarrior!\r\n");


    while (1)
    {
        *(uint8 *)(0x82000000 +0x11) = 0xff;
        for (sl1=0; sl1<1000000; sl1++) { }

  printf("Welcome to CodeWarrior!\r\n");

        *(uint8 *)(0x82000000 +0x11) = 0xf0;
        for (sl1=0; sl1<1000000; sl1++) {}
printf("Welcome to CodeWarrior!\r\n");
    } // loop forever
    
 
    
    return 0;
}


 

The debugger prints the first Welcome to codewarrior, but never prints the second one. Also, any code added before the while loop,  the debugger executes it normally. It seems that whenever I try to acces the memory the debugger never executes the instruction.

 

Thank you for your help.

 

0 Kudos

923 Views
bbjh1
Contributor I

I've already submitted a service request and they told me I need to follow the Section "Creating a Bare Board Project" in the
Targeting mobileGT Processors.pdf. Whenever I create an EPPC project this is the C code that I get,

 

#include <stdio.h>
void main()
{
     printf("Welcome to CodeWarrior!\r\n");
   
}

I don't get anything about system_call() or anything that defines the board. Is there anything missing? Thank you.

0 Kudos