µTasker Forum
µTasker Forum => NXPTM M522XX, KINETIS and i.MX RT => Topic started by: evgenik on February 22, 2009, 06:37:23 AM
-
Hi Mark.
At this time I work with boot loader.
I can upload new HS.bin file but (I view this by checking file length) its length is wrong: its length is 230884 bytes and uTasker write it as 310000 bytes. I want check all path of upload: from press 'Upload software' button, calculation file length, up to writing it to SPI flash. All files length used by uTasker, HTMLs calculated right. What is the best way to do this?
I work with Freescale 52235 micro, AT26DF081A SPI flash, uTasker v1.6 and use these definitions for this flash:
#ifdef SPI_EEPROM_1024K
#define EEPROM_PAGE_SIZE (256)
#define SPI_FLASH_PAGE_LENGTH_256K (256)
#define SPI_FLASH_BLOCK_LENGTH (4096) // block size 4k( 4096 bytes) - a block can be deleted
#define SPI_FLASH_PAGES (4 * 1024) // 4096 pages of 256 byte each page
#define SPI_DATA_FLASH_SIZE (SPI_FLASH_PAGES * SPI_FLASH_PAGE_LENGTH_256K)
#define SPI_FLASH_START (FLASH_START_ADDRESS + SIZE_OF_FLASH)
#define FILE_GRANULARITY (4096) // File made up of 4k byte FLASH blocks
#define SINGLE_FILE_SIZE (FILE_GRANULARITY) // each file a multiple of 4k
#define FILE_SYSTEM_SIZE (64 * SINGLE_FILE_SIZE + PAR_BLOCK_SIZE)
#define NEW_UTASKER_APP_ADDRESS 0x0AF000
#define TEST_FLASH_ADDRESS (SYS_PARAMETERS + SINGLE_FILE_SIZE)
#endif
For receive NEW_UTASKER_APP_ADDRESS (that outside of uTasker spaces) I use with macro in uFile.c->static MAX_FILE_SYSTEM_OFFSET fnGetFilePointer(CHAR *ucIp_Data) :
#if defined SPI_SW_UPLOAD
if (SW_UPLOAD_FILE()) {
return (MAX_FILE_SYSTEM_OFFSET)(NEW_UTASKER_APP_ADDRESS - PAR_BLOCK_SIZE);
}
#endif
in app_hw_m5223x.h
#define SW_UPLOAD_FILE() (*ucIp_Data == 'H') && (*(ucIp_Data+1) == 'S') && (*(ucIp_Data+2) == '.')
Thanks.
Evgeni
-
Hi Evgeni
I have seen (also from your email) that you are working with an SPI FLASH type which is not included in the uTasker project.
You have thus written also a new SPI driver interface for this type, being multiplexed with another SPI device (FPGA).
This means that it is difficult to say where the problem is and could be in the commands used together with this SPI FLASH type, its new driver code or elsewhere.
1) Are you sure that the basic read/write is operating correctly? If not, there may be basic problems with reading back the length of file which was saved.
2) I would first check which length the file system routine is actually (trying) to save to the SPI FLASH. To do this put a break point in uFileCloseMime() at
if ((fnWriteBytesFlash(ptrFile, (unsigned char *)&Len, sizeof(MAX_FILE_LENGTH))) != 0) { // write the length to the file
Len = 0;
}
Is the value contained in Len 230884 or 310000? What address is ptrFile?
3) When reading the length of the file back, check that the same location is used for the read and then whether the content is as expected.
These first tests may help identify in which area the problem is.
Regards
Mark
-
Hi Mark.
I put breakpoint into fnPostFrame(..) fuction and see into ucIp_Data the next data: Host: 192.168.10.13..Content-Length:231133.
Before this part
#ifdef SUPPORT_POST_BINARY
if (!(uMemcmp((unsigned char *)cContentType1, ucIp_Data, (sizeof(cContentType1) - 1)))) {
ucIp_Data += (sizeof(cContentType1) - 1);
usPortLen -= (sizeof(cContentType1) - 1);
http_session->FileLength -= ((sizeof(cContentType1) - 1) + 2);
http_session->FileLength -= http_session->ucBoundaryLength;
http_session->ucState = HTTP_STATE_POSTING_DATA;
break;
}
#endif
http_session->FileLength = 231077 and after this part http_session->FileLength = 231001.
In windows I check file length by mouse right button click and it is: 230,884 bytes. Into uFileCloseMime(..) file length = 231001.
When Bootloader startup in fnCheckNewCode(..)
MAX_FILE_LENGTH file_length = uGetFileLength(UPLOAD_FILE_LOCATION); receive written before file lingth (231001) and
fnGetPars(UPLOAD_FILE_LOCATION + FILE_HEADER, (unsigned char*)file_header, SIZE_OF_UPLOAD_HEADER); receive true length of file (written into file header).
My project after short time shall be finished but this bug don't give possibility do this.
I need your help!
Thanks. Have a good day.
Evgeni.
-
Hi Evgeni
1) In SP9 there is a new version of HTTP which has improved handling of HTTP post. The reason was that it was found that some HTTP clients (like cURL) were sending the header data in a way that was causing difficulties. It was however not resulting in a bad file length but rather not being recognized correctly to post (no post took place).
It should be possible to use the HTTP.c file from the latest SP to see whether this helps your problem - check the new defines in config_ref_sp9.h and tcpip.h.
2) If you send me a Wireshark recording of the POST transfer which is causing difficulties, plus a copy of the file being sent, I can play this through the uTasker simulator with SP8 and SP9 HTTP code to see whether there is generally a problem, or a problem with a particular version (tell me exactly which SP version you are using as a base for your project). The Wireshark recording ensures that the simulation respects the exact browser version that you are using to that I can see every detail and is thus much more reliable than when I try with some Browser types which may operate slightly differently.
Regards
Mark