M52233 : I am a newbies PLEASE help me to create an socket please please please !!!! :'(

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

M52233 : I am a newbies PLEASE help me to create an socket please please please !!!! :'(

2,100 Views
o0Zz
Contributor I
Hello all world,

After 2 weeks of research , I don't have succeed to create an simple socket on the M52233 like windows :

socket(AF_INET,SOCK_STREAM,0);
connect(IdSocket,(SOCKADDR *)&adr_serveur,sizeof(adr_serveur));
send (IdSocket, BUFFER, size, 0);

I am despaired because on this forum all peoples said : "there are an exemple in directory of CodeWarrior..." but I don't find exemple for create socket... or if I find an exemple this exemple don't functions !!!

Please help me, to create a simple socket who functions!! :'( :'( :'( :'(

I don't know how to use the eth.h and other files...

If you are an tutorial which good exemple and screen for realise this ?

I have look and download and install the module of http://www.utasker.com/ and he functions but he don't explain how to create a socket .... :smileysad: (but the person in charge of the website is very simpatical ^^)

I am despaired, thanks for your answer and sorry for my bad english ... I'am french


Labels (1)
0 Kudos
3 Replies

377 Views
mjbcswitzerland
Specialist V
Satut oOZz

Si tu as une question au sujet du uTasker, ne pas hésiter de me la demander -  j'essayera de répondre à toutes les questions aussi rapidement comme possible.

Here are details of how you can create a listening socket using uTasker:

1. Create a socket (for defines see tcpip.h in the folder "stack" ).
USOCKET MySocket = fnGetTCP_Socket(TOS_MAXIMISE_THROUGHPUT, TCP_DEFAULT_TIMEOUT, fnMyListener);

2. Start listening on a certain port (here 1234) with
fnTCP_Listen(MySocket , 1234, 0);
This will announce a rx windows size the same as the LAN rx buffer. In applications with TCP buffering (see for example TELNET) the maximum windows size can be set with the last parameter, depending on buffer sizes available.

3. The call back handler fnMyListener() does the work. It receives the following events:
TCP_EVENT_CONREQ:
TCP_EVENT_ABORT:
TCP_EVENT_CLOSED:
TCP_EVENT_CONNECTED:
TCP_EVENT_ACK:
TCP_EVENT_REGENERATE:
TCP_EVENT_DATA:
TCP_EVENT_CLOSE

The best way to learn about using these is to run the simulator and record it serving a page from a Web Browser. Store the Ethereal recording of this and then play it back through the simulator (see the uTasker tutorial for details of how to do this). Set a break point in fnHTTPListener() and you will see how each received frame is handled depending on its event type.

For higher perfomrance using windowing (down side is that it requires more RAM) a TELNET 'type' socket can be opened. See the example in debug.c in the uTasker project. Such a socket is special since it then performs the TCP call back handling for you including windowing, reps etc and achieves high throughput with reliable TCP flow control - it can be used in pure TELNET mode or as a RAW TELNET socket (that means that it doesn't do any negotiation but supports the buffering).

I hope that this helps you get going.

Regards

Mark


0 Kudos

377 Views
mjbcswitzerland
Specialist V

Hi oOZz

In response to your question sent in a direct email:

>>1. uTasker is an RTOS - have I understood this correctly?

1. uTasker is an operating system (OS or RTOS) with TCP/IP stack and also various drivers needed to be able to use the M5223X peripherals). It is delivered in the form of a demo project that can be built using CW (that is, it is delivered with a CW project). In the next service pack there will also be a GNU make file which allows a project to be built also with GCC and debugged using GDB (using Eclipse for example).

>> How do I create my own CW project. I have tried making a new project and adding various uTasker files but this gives loads of errors when I try to compile it. I have studied the uTasker tutorial but there is no explanation about how to create a new CW project. Am I going about it the wrong way?

2. The simplest method of making your own project is not to make a new CW project (although this is possible – see point 3) but to copy the directory \Applications\uTaskerV1.3. Rename it to the name of your project and open the CodeWarrior_M5223X directory in it and use the uTaskerV1.3.mcp project (if you want you can rename the project as well).
This should build as the
uTaskerV1.3 project.
Then you can make any changes that you would like to make. For example removing parts that you don’t need and adding new tasks and files.

3. If you want to build a completely new project you will have to ensure that the CW is set up correctly.
You will need the following files in the project:
- M52235EVB_FLASH.lcf for the linker
- startup.s  (mcf5223x_boot.s is only required by the boot project and so is not required in the application project). If you want to be able to upload your project over the web server you will need to have a build configuration using M5223_BOOT_APP_FLASH.lcf (see the demo project since it supports multiple configurations).
- M5223X.c This includes main() so that the assembler code can jump to the operating system.

- the uTasker directory for the operating system.
- the stack directory to be able to use the TCP/IP support
- An application part (this will depend on the task configuration and the main project configuration – these are defined in config.h and TaskConfig.h and app_hw_m5223x.h). For example TaskConfig.h defines that the project runs tasks called application(), debug() and possibly other too. The ones which are defined have to be somewhere in the project!

The processor target must be set to suit the M52233.
Access paths have to be set to suit the project (include files)
The C/C++ -Processor settings must include project defines (#define _M5223X     #define _CODE_WARRIOR    #define _CODE_WARRIOR_CF) are required for the
uTasker project for the M5223X.

This means that setting up a project does require knowledge of how CW works as well as various details of the project itself, and so can be a little complicated.

For this reason it is certainly simpler to follow suggestion 2 because the CW project is then already set up to run, and you can concentrate on your own application code rather than studying how CW operates.

Note that the uTasker tutorial doesn’t explain how to create a CW project since there are details about this in the CW help. The uTasker supplies the necessary CW project so it is normally not necessary to understand the CW details to be able to use the uTasker and also to modify the demo project for your own applications.

I hope that this helps you.

Regards

Mark

0 Kudos

377 Views
o0Zz
Contributor I
Hello,

Finnaly I have succeeded to create an socket with utasker.

My problem :
I was don't succeeded to debug utaker and I did have this error : "Exception vector name: Address Error".
If you have this error follow this instruction :

1) Start the project "utasker\Applications\uTaskerV1.3\CodeWarrior_M5223X\uTaskerV1.3\uTaskerV1.3.mcp"
2) Compil the project
3) Send .s19, that you have compil, to the M52233DEMO with "CF Flasher 3.1" for exemple
4) Start the debugger and now You have no error :smileyhappy:

In reality the problem arrive because the startup.s dont find the adresse to move...

Thank you Mark.


0 Kudos