Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - johnr

Pages: 1 2 3 [4] 5 6 7
46
NXPTM M522XX, KINETIS and i.MX RT / Re: Web binary file download
« on: October 29, 2007, 03:32:47 PM »
Thomas. I've been sidetracked for a few days. I tried putting the
"Content Type: application/octet-stream"  etc in the <HEAD> section of the page using the meta  HTTP equiv and in the <A HEF ...> tag in the link, but IE 6 does not care and just
displays the file. It works with FireFox 2.


 Thanks,
 John

47
NXPTM M522XX, KINETIS and i.MX RT / Web binary file download
« on: October 24, 2007, 03:38:08 PM »
Hi, I'm going to store some NV params in a file, Z.BIN, which our application can save and load on bootup. I'm using a file instead of the paramter block because it would require less hacking into the code when
services packs etc are released. We can download this file via Firefox 2.0
and save it on the PC. It pops up a "Save as" box when it determines it's
a binary file.  I was looking at the Ethereal trace and it doesn't look like the web server sends HTP headers describing the file, so Firefox must determine this by the extension or maybe it looks at the file contents. When we do a software update we can then FTP the paramater file back up to the unit.
 When I tested this on IE 6.0 ,it doesn't pop up a "Save as" box, but just dumps this on the screen. I added a binary header to the start of the file,
thinking maybe IE analyzes the file to determine what to do with it, but
it still just dumps it. I then added HTP headers

"Content Type: application/octet-stream\r\nContent-Type: application/force-download\r\n\Content-Length=2048\r\nContent-Transfer-Encoding: binary\r\nContent-Disposition: attachment\r\n\r\n"

 to the beginning of the file, but IE still doesn't pop a "Save as" box. I can see the header in Ethereal, so they're getting out on the line.
Is this a IE issue ? I googled around and they suggest adding the above
header to force IE to save the file. IE doesn't seem to have any settings
to tell it what to do with MIME type of application/octet stream.

 Anyone have any ideas on this ?


 Monitoring an Appache web server and accessing a .bin file on it, I notice
that it sends down an HTTP header file in a sperate packet containing

HTTP/1.1 304 Not Modified
Date: Wed, 24 Oct 2007 20:28:16 GMT
Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8 mod_ssl/2.2.3 OpenSSL/0.9.8c
Connection: Keep-Alive
Keep-Alive: timeout=15, max=84

 IE doesn't know what kind of file it is and pops up the "Save As" box.
It seems like IE will interpret a file as text/HTML if it has no header and
the HTTP header must be in a seperate frame from the actual data.

 Thanks,
 John



48
NXPTM M522XX, KINETIS and i.MX RT / Re: Web Server not responding
« on: October 18, 2007, 02:39:39 PM »
Hi Mark, I ran it overnight and saw the "Cannot
find server" screen, but was able to manually refresh it and it looks ok now. I was able to ping it all night with 0 packet loss.

 John

49
NXPTM M522XX, KINETIS and i.MX RT / Re: Web Server not responding
« on: October 17, 2007, 09:38:58 PM »
Hi Mark, Yes, #define HTTP_WINDOWING_BUFFERS 2 was set.
I made all the changes in the release note pertaining to our usage
and will test it out tonight.


 Thanks,
 John

50
NXPTM M522XX, KINETIS and i.MX RT / Web Server not responding
« on: October 17, 2007, 02:36:23 PM »
Hi, I've been testing my new web page overnight for the last 2 nights
and when I come back in the morning  the browswer is hung in a "Cannot
find server" screen. I can still ping and FTP the board at this point, but can't access any web page. This has happened before I included the floating point library in the project and afterwards.
 My test page uses "<meta http-equiv="refresh" content="20">"  to
refresh the page every 20 secs. I've tested the page during the day
and it looks OK, displaying the proper values etc.
 I made the changes in the web server code to supports 5 char £xxxx
sequences and every page looks OK. The code I added in webinterface.c
in fcInsertString() to handle my new page is

Code: [Select]
case 'W': //  ADC Raw
iChan=*ptrBuffer;
iChan-='1';
cPtr = fnDebugDec( (long)ADC_Chans[iChan].Raw, 0, cValue);
*usLengthToSend = (cPtr - cValue);
break;

case 'Z': // ADC Min
iChan=*ptrBuffer;
iChan-='1';
         cPtr = fnDebugDec( (long)ADC_Chans[iChan].Min, 0, cValue);
    *usLengthToSend = (cPtr - cValue);
break;

case 'H': // ADC Max
iChan=*ptrBuffer;
iChan-='1';
        cPtr = fnDebugDec( (long)ADC_Chans[iChan].Max, 0, cValue);
    *usLengthToSend = (cPtr - cValue);
break;

case 'T': // ADC AlarmLo
iChan=*ptrBuffer;
iChan-='1';
cPtr = fnFltToStr(ADC_Chans[iChan].AlarmLo, cValue);
    *usLengthToSend = (cPtr - cValue);
break;


case 'G': // ADC AlarmHi
iChan=*ptrBuffer;
iChan-='1';
          cPtr = fnFltToStr(ADC_Chans[iChan].AlarmHi, cValue);
*usLengthToSend = (cPtr - cValue);
break;

case 'Q': // ADC AlarmState
iChan=*ptrBuffer;
iChan-='1';
          cPtr=uStrcpy(cValue,aAlarmStates[ADC_ChansiChan].AlarmState]);
         *usLengthToSend = (cPtr - cValue)-1;
break;


 Looking at the memory stats before and after it hangs shows
     Free heap = 0x0af4 from 0x4c00
     Unused stack = 0x2823
 so that looks OK.

 I can try refreshing a dummy page that doesn't do any
dynamic processing overnight and see what happens. I've been running
my regular page for 3.5 hours this morning so far and it hasn't
failed yet. I've been running these tests from the CW debuger.


Here's my string <--> float functions, but the web hung before used these

Code: [Select]
float fnStrToFlt(char* aStr) {
// Convert a non terminated string to a float. Limited to 1 dec place

float Result=0;
int i,Frac=0;
int Mult=1,Len;
int DecPlaces=0;
char* pEnd=aStr;
char* pDec=NULL;

  while (((*pEnd>='0') && (*pEnd<='9')) || (*pEnd=='.') ) {
// Find the end of the str
if (*pEnd=='.')
  pDec=pEnd;  // Remember decimal place
pEnd++;
  }
  Len=pEnd-aStr;
  if  (pDec)
DecPlaces=pEnd-pDec-1;

  while (DecPlaces>1) {
// Limit to 1 dec place
pEnd--;
Len--;
DecPlaces--;
  } 

  while (Len-->0) {
--pEnd;
if (DecPlaces>0) {
  if (*pEnd!='.')
Frac=((*pEnd)-'0');
  pEnd--; // Skip dot
  DecPlaces--;
  Len--;
}
else {
  i=((*pEnd)-'0');
  i*=Mult;
  Result+=i;
  Mult*=10;
}
  }
  if  (Frac>0)
Result+=(float)Frac/10; 
return(Result);
};


char* fnFltToStr(float aFlt, char* aStr) {
// Convert a float to a non terminated string. Return
// a pointer to the next char posistion that would have
// been written. Len of the string=cp-aStr. Limited to 1 dec
// place 

int i=(int) aFlt; // Chop off fraction
float f=aFlt-i; // Fraction
char* cp;

cp=fnDebugDec(i,0,aStr); // int part
*cp++='.'; // decimal point
if ((f*=10)) {
if ((int) (f*10)>=5)
  f+=.1;

}
i=(int)f;
cp=fnDebugDec(i,0,cp); // fractional part
return(cp);
}

 Thanks,
 John


51
Hi, I did receive a response from the FreeScale forum and someone
suggested I include fp_coldfire.a, which is locted in the Freescale CW
tree. It did allow me to do some basic operations with floats. I wrote
2 functions that converted from strings<--> floats with a 1 decimal place
preccesion and the .bin file increased about 5K

 Thanks,
 John

52
Hi Mark, thanks for the info on the library usage. When I find an answer to
the floating point issue I'll let you know.

 John

53
NXPTM M522XX, KINETIS and i.MX RT / CW 6.3 librarys and floating point
« on: October 12, 2007, 04:04:22 PM »
 After playing around with librarys the last 2 days, here's
what I found.

 If I add C_4i_SZ_MSL.a to the support files, I can use malloc() by
including "stdlib.h" in the source. In order to do this I must
comment out size_t in types.h because stdlib.h defines this as an
unsigned long and we get "size_t redeclacred" errors. When I remove  C_4i_SZ_MSL.a from Support Files, I get an error, "can't find malloc()"
so this tells me I can use MSL libs in the project.

  I modified ansi_prefix_CF.size.h in the FreeScale CW tree as per
a FreeSCale thread and re built MSL_C.CF mcp  by opening up
the project in the FreeScale CW tree.  After adding C_4i_MSL.a
to the Support Files and using the test code I get a "_f_itoa" link
error.



// ansi_prefix_CF.size.h in FreeScale tree
#if !(__COLDFIRE__ == 0x4080 && !__option(fp_library))
////#define _MSL_FLOATING_POINT      0
////#define _MSL_NO_MATH_LIB                    1
#define _MSL_FLOATING_POINT      1
#undef _MSL_NO_MATH_LIB
#endif

////#define _MSL_FLOATING_POINT_IO            0
#define _MSL_FLOATING_POINT_IO      1


// Simple float test code
 float f;
 int i;

 f=i;


 I also tried adding libgcc.a and libm.a from my CodeSourcery 4.11
tree to Support Files and get the same link errors. I called a CW
sales rep and asked if floating point is supported in all the versions
and am waiting to hear back.

 One thing I noticed after adding the C_4i_MSL.a lib to the project is
that the floating point option in the Coldfire Processor property tab
is still disabled. When I flipped around to use other processers it
seems to only get enabled when you specify a chip that has a hardware
FPU


 Thanks,
 John


 

54
NXPTM M522XX, KINETIS and i.MX RT / Re: Floating point library
« on: October 11, 2007, 06:23:22 PM »
Mark,
 just adding this line in my code causes link errors,
 "undefined _f_itof and undefined _f_imul".
p->AlarmHi is a float var. I don't call any math.h
functions.

   p->AlarmHi=(float)(i+1)*100;


 I'll try the GCC approach and let you know.

I tried using libgcc.a and libm.a from my CodeSourcery 4.11
install. They were under the M5213 dir, which seemed to be closest
to the M52233 chip. I added them under the SupportFile dir and got
the same link errors as before, just doing a simple mult operation
on 2 ints and storing them in a float.

 I read through the CF targeting PDF, and they don't mention
any floating point restrictions with the 6.3 Special Edition. It says
it lacks V2 and V4e simulatiohn, whatever that means.

 A closer look at the FreeScale site does not mention any floating point
limitations with the CW Special Edition  but I see they sell 2 versions of the Standard
Edition, one with an E and one with a FLOA suffix, which costs $300 more.


 When I tried to add C_4i_CF_SZ_MSL.a and added
#include <stdlib.h> at the start of one of my source files to test
out malloc(), I got "size_t redeclared errors". This is defined in the
MSL lib and in the project's types.h

 Thanks for the help,
 John

55
NXPTM M522XX, KINETIS and i.MX RT / Re: Floating point library
« on: October 11, 2007, 02:22:14 PM »
Hi , I read the threads in the FreeScale forum pertaining to runtime libraries
and have read the sections in the CF tools manual regarding them, but I still don't
see how to add/deleate librarys from a project. I posted this question up in
the FreeScale forum yesterday, but haven't gotten a response yet.

In the project menu the floating point option is set to software, being there is no FPU in the chip, but is greyed out. The manual say to include the appropriate libary to enable this option. I read in a thread to set the following in ansi-prefix.cf.size.h located in the FreeScale
CW dir tree
 
#if !(__COLDFIRE__ == 0x4080 && !__option(fp_library))
////#define _MSL_FLOATING_POINT     0
////#define _MSL_NO_MATH_LIB                    1
#define _MSL_FLOATING_POINT     1
#undef _MSL_NO_MATH_LIB
#endif
////#define _MSL_FLOATING_POINT_IO    0
#define _MSL_FLOATING_POINT_IO    1
 
 and rebuilt the project, but still get the link errors when I try to work with a float var . I assume the default project is using the * SZ.a libs, which don't support FP. How do I
specify using the regular libary in a project ? Is there a way to see what MSL libs are
included in a project so as to remove unnessesary ones ? Just taking a stab in the dark, I tried
adding various CF_4I*MSL*.a files to the Support Files folder in the project with no luck
 
 Thanks,
 John


56
NXPTM M522XX, KINETIS and i.MX RT / Floating point library
« on: October 09, 2007, 07:37:13 PM »
Hi , we may need to use floating point to do some ADC conversions.
The CW 6.3 lite help mentions that the M52233 lacks an FPU and in order
to enable software FP you must "include the appropriate FP_Coldfilre library"
into your project. I looked in the CW help and can't see how to do this.
Anyone ever include FP in their projects and if so how much memory would this
require.

 Thanks,
 John

57
Mark, I figured it out looking at ethereal. When you submit the form ,fnHandleWeb()
will get passed the name of the SELECT control, Y1 .. Y8 in my case, The following
code allows me to get the char after the Y and then the value it is set to.
When handling form data from the browser, the first char of the name of the control gets passed to fnHandleWeb(). If it is more than 1 char you can keep parsing it and then skip the = to read the value.

 

      case 'Y':
        // Handle ADC Input type selection
        // Coded as £sY {Value 'A'..'Z'} {Channel 1..8}
        iChan=*(ptrData++); // Get value before =, channel num 1..8
        iChan-='1';
        iVal=*(++ptrData);  // Get value after = A..Z Input type
        iVal-='A';
        ADC_Chans[iChan].Type=iVal;
        break;   


 John


58
Mark, I padded out all the £xyz tags to 5 chars in the HTML files by adding a space at the end. I modified fnWebParGenerator() in webutils.c as follows, using the WEB_ESCAPE_LEN
define, which is now 5:

 while (usLen) {       // We scan the HTTP frame to be sent, looking for a position to fill out
        if (*ptrBuffer++ == (unsigned char)WEB_PARSER_START) {       // a field has
            // if (usLen <= 4) {                                            // check whether long enough s
            if (usLen <= WEB_ESCAPE_LEN) {                               // check whether long


 // ptrBuffer += 2;                                              // jump over parameters
 // usLen -= 3;
 ptrBuffer += (WEB_ESCAPE_LEN-2);                     // jump over parameters
usLen -= (WEB_ESCAPE_LEN-1);


 and modified  fnInsertHTMLString() in webutils.c to replace all occurances of 4
with WEB_ESCAPE_LEN.

 So far it looks like it didn't break any existing code. I'll code my web pages to use the extended length and test it with the simulator.


 Thanks for the help,
 John

 

59
Mark, I did get the project to run in VC and was able to set a break point in webinterface.c
I FTP'ed the web pages up to the simulated machine and was able to view them via the
browser. That was neat :)
I will modify the web pages to pad out the £xyz tags to 5 chars and will modify webinterface.c and webutils.c as you suggested and see if it works. I'll keep you posted.

 Thanks for the help ...
 John
 

60
Mark and John,
 I disabled all unnessescary services and turned off global
optimazation and set either the "faster execution" or "smaller code size" options and still couldn't get CW to break on the C function fnInsertString() in webinterface.c !
 I also tried setting the #pragma global_optimizer off at the beginning
of the webinterface file with no luck.

 Thanks,
 John

Pages: 1 2 3 [4] 5 6 7