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

http_cgi.c include problem

Hello everyone,

I want to create a dynamic page.

When i try to include http_cgi.c in my project i get the following errors:

1. http.axf: Error: L6200E: Symbol cgi_process_var multiply defined (by at_http_cgi.o and http_cgi.o).

2. http.axf: Error: L6200E: Symbol cgi_func multiply defined (by at_http_cgi.o and http_cgi.o).

What am i doing wrong?

thanks and regards

Akshat

  • you have a symbol with an external linkage defined more than once - where does the file 'at_http_cgi.c' come from? you could make the function static.

  • as far as i can imagine, at_http_cgi.o is from the library (the only one i have in my project it RTLTCP.lib).

    No other file of this nature is included otherwise.

    I have net_config, serial, startup, main...

    I'll try to make it static.

    Thanks,
    Akshat

  • Well static function won't work, cause i want MY cgi_func() to be used not the one whose source i can't define (i'm sure it's in the library).

    Is there any other way to update the web-page with variables from my program?

    I want the web-page to display a buffer which is filled from serial data via the other serial port.

    Thanks

    Akshat

  • why don't you simply change the name of your function? If you have access to the place where it is called, you have no problem. As far as I know, in C you can not just remove a symbol from the global namespace.

  • Oh i could do that but the function i want to REMOVE is in the library(which is a closed-source!) :(

    Akshat

  • No no no no no no no no
    You are trying to name your own function just like one in the library. Change the name of your function to get rid of the ambiguity, so it does not collide with the library name!

  • The culprits are in 'http_cgi.c' !

  • OK i think there is some confusion...

    Both the library and http_cgi.c are from keil only. The manual says that one needs to copy http_cgi.c to one's own project if one needs to modify the cgi_func().

    But when i include http_cgi.c in my project, two copies of cgi_func() are seen by compiler(one in library and one in http_cgi.c).

    The project compiles fine without http_cgi.c and the cgi_func() from library works OK. But the added functionality i want to add to cgi_func() through http_cgi.c is not there.

    Kindly have a look at http://www.keil.com/support/man/docs/rlarm/rlarm_cgi_func.htm

    and see what i mean in detail.

    Thanks and regards,

    Akshat

  • Are the *.o file linked before the library?

    If the library is linked before any *.o file, then the library will "fill" any missing symbols, and then the linker is forced to include the *.o file and gets collisions.

  • Westermark,

    That was a possible solution i too thought of(to link the http_cgi.c before the RTLTCP.lib), but i've no idea how to go about doing it in uVision.

    Please guide me for the same.

    Thanks and regards,

    Akshat

  • that is easy if you build your code outside uv3. use a make file - here is an example, just change the source files names:

    CC  = armcc
    LNK = armlink
    ASM = armasm
    
    # define the C object files
    #
    # This uses Suffix Replacement within a macro:
    #   $(name:string1=string2)
    #         For each word in 'name' replace 'string1' with 'string2'
    # Below we are replacing the suffix .c of all words in the macro SRCS
    # with the .o suffix
    #
    PROJ               = scheduler
    
    SRCS = 91x_gpio.c 91x_it.c 91x_scu.c 91x_tim.c 91x_uart.c 91x_vic.c 91x_wdg.c config.c hardware.c LED.c main.c priority_queue.c queue.c Retarget.c scheduler.c Serial.c swi_functions.c synchronization.c system_notifications.c system_services.c timer.c trace_buffer.c
    OBJS = $(SRCS:.c=.o) SWI.o STR91x.o
    
    DEBUG = -g
    
    CFLAGS   = --device DARMST9 --feedback ".\bin\scheduler.fed" -Otime -O2 -c $(DEBUG) --apcs=interwork -DLIBRARY_IO_SUPPORT -DTRACE_BUFFER_MODULE -DTIMER_MODULE -DSEMAPHORE_MODULE
    LFLAGS   = --device DARMST9 --feedback ".\bin\scheduler.fed" --strict --autoat --summary_stderr --info summarysizes --map --xref --callgraph --symbols --info sizes --info totals --info unused --info veneers
    ASMFLAGS = --device DARMST9 $(DEBUG) --apcs=interwork --xref
    
    TOOLCHAIN_INC_PATH = D:/Keil/ARM/INC/ST/91x
    ARMLIB_PATH        = D:/Keil/ARM/RV31/LIB
    
    # define any directories containing header files
    #
    INCLUDES1 = D:/Keil/ARM/INC/ST/91x
    INCLUDES2 = D:/Keil/ARM/RV31/INC
    
    STR91x.o:
            $(ASM) $(ASMFLAGS) -o ./bin/$@ STR91x.s
    
    SWI.o:
            $(ASM) $(ASMFLAGS) -o ./bin/$@ SWI.s
    
    .c.o:
            $(CC) $(CFLAGS) -I "$(TOOLCHAIN_INC_PATH)" -I "$(INCLUDES2)" -o ./bin/$@ $<
    
    all: $(OBJS)
            $(LNK) --libpath "$(ARMLIB_PATH)" $(LFLAGS) --list "./lst/$(PROJ).map" --userlibpath="./bin" $(OBJS) --output ./bin/$(PROJ).axf
    
    clean:
            del /Q .\bin\*.*
            del /Q .\lst\*.*
    
    
    depend: $(SRCS)
            makedepend -I"$(INCLUDES1)" -I"$(INCLUDES2)" $^
    
    # DO NOT DELETE THIS LINE -- make depend needs it
    

  • Yes I know it is a little messy, the associated project is still a prototype (but not for long...). you would need to change the paths as well, and the tool chain path and .exe names, if you don't use RealView.

  • Most likely you do not have a cgi_func() in your HTTP_CGI.c module, or you have renamed it by a mistake. Then the missing function is linked from the library from the module at_http_cgi.o which includes also the other two functions into the link.

    However you must be using RL-ARM version v3.13 or older. I strongly recommend an upgrade to current RL-ARM version.

    Franc

  • @ Tamir, thanks for the valuable input, but i really don't have time in hand to try that out, plus it's not too much in my domain to understand the make file, i'm essentially a h/w guy :).