This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MCBC167-NET WITH EASYWEB PROGRAM

Hello forum:
I'm using the easyweb program in may evaluation board MCB167_NET. The problem is that, when I want to do the web page longer than the original one, keil sais taht the string is too long, why???? How can I put all the information that I want in a array
webside[]{...};
The array is unsigned char type, I have changed it for an unsigned long but the error persists. Keil sais:
string too long(4096:4096).
Has anybody a solution for my question.
Thank you.
Sergio

Parents
  • Hi Sergio,
    I think I've found a way to splice long strings into a longer one (above 16384 bytes) avoiding complaints from the C166 compiler. It's kinda ugly, but it works:

    #define PART1 "This is the first part of the web page\n""Feel free to modify""but don't forget about the 4096 byte limit.\n"
    #define PART2 "a lot of data...""but less than 4096 bytes"
    
    #pragma pack(1)
    
    union {
        struct {
            char p1[sizeof(PART1)];
            char p2[sizeof(PART2)];
        } data;
        char str[1];
    } const huge page={PART1,PART2};
    
    extern void serve_page(char huge* str);
    
    void main(void)
    {
        serve_page(page.str);
    }
    
    Well, you get the idea. Note the #pragma pack(1) and huge. The pragma ensures that there are no gaps in the structure (default behavour of C166 is to align structure members at word boundaries). The huge modifier is there because the structure is bigger than 16384 bytes. You will need xhuge if it's bigger than 65536 bytes. Of course you have to make sure that the web server is able to handle the huge pointer, but I'm sure you can work it out.

    - mike

Reply
  • Hi Sergio,
    I think I've found a way to splice long strings into a longer one (above 16384 bytes) avoiding complaints from the C166 compiler. It's kinda ugly, but it works:

    #define PART1 "This is the first part of the web page\n""Feel free to modify""but don't forget about the 4096 byte limit.\n"
    #define PART2 "a lot of data...""but less than 4096 bytes"
    
    #pragma pack(1)
    
    union {
        struct {
            char p1[sizeof(PART1)];
            char p2[sizeof(PART2)];
        } data;
        char str[1];
    } const huge page={PART1,PART2};
    
    extern void serve_page(char huge* str);
    
    void main(void)
    {
        serve_page(page.str);
    }
    
    Well, you get the idea. Note the #pragma pack(1) and huge. The pragma ensures that there are no gaps in the structure (default behavour of C166 is to align structure members at word boundaries). The huge modifier is there because the structure is bigger than 16384 bytes. You will need xhuge if it's bigger than 65536 bytes. Of course you have to make sure that the web server is able to handle the huge pointer, but I'm sure you can work it out.

    - mike

Children