From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60050 invoked by alias); 17 Nov 2015 16:23:46 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 60024 invoked by uid 89); 17 Nov 2015 16:23:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,MALFORMED_FREEMAIL,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 17 Nov 2015 16:23:44 +0000 Received: by wmww144 with SMTP id w144so33438544wmw.0 for ; Tue, 17 Nov 2015 08:23:41 -0800 (PST) X-Received: by 10.194.9.104 with SMTP id y8mr44430763wja.106.1447777421161; Tue, 17 Nov 2015 08:23:41 -0800 (PST) Received: from sg-laptop ([37.45.182.160]) by smtp.gmail.com with ESMTPSA id n127sm13438830wmf.12.2015.11.17.08.23.39 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 08:23:40 -0800 (PST) Date: Tue, 17 Nov 2015 16:23:00 -0000 From: Sergei Gavrikov To: Robert H cc: eCos Discuss In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Subject: Re: [ECOS] ecos hal symbol table creation mechanism X-SW-Source: 2015-11/txt/msg00003.txt.bz2 On Mon, 16 Nov 2015, Robert H wrote: > Hello all, > > I have some questions concerning the ecos hal symbol table creation in > hal_tables.h > > How is it possible to export a symbol which is in the ecos image into > some object file for it being able to call it? > > I know that test_mods.c uses some defines the object file - that the > application programer wants to load - uses some defines: > e.g. > CYG_LDR_TABLE_ENTRY(cyg_alarm_create_entry,"cyg_alarm_create",cyg_alarm_create); > > which then gets replaced by > > cyg_ldr_table_entry __name CYG_HAL_TABLE_ENTRY(ldr_table) = { > __symbol_name, __handler }; // line 141 in objelf.h > // with __name being a struct of > // { char *__symbol_name , void *__handler }; > // where is the definition of ldr_table? I can't seem to find it anywhere > > and then again gets replaced by > > cyg_ldr_table_entry __name > __attribute__((section(".ecos.table.ldr_table.data")) = { > __symbol_name , __handler }; > // line 103 in hal_tables.h > > Does the section attribute here tell the compiler to put a struct > cyg_ldr_tables_entry entry (in this example: {"cyg_alarm_create" , > cyg_alarm_create} ) > into the ecos image's section .ecos.table.ldr_table.data? Correct. Look on HAL arch. linker script(s). E.g. for ARM architecture https://sourceware.org/viewvc/ecos/packages/hal/arm/arch/current/src/arm.ld?revision=1.23&view=markup#l329 > Then again, I wonder then how the ecos is able to get the adress of > the function/symbol cyg_alarm_create into the handler > cyg_alarm_create. > > I would be very pleased to know more about how the mechanism to get > ecos symbols works in hal_tables.h Generally and particularly (objloader case) the table boundaries are known https://sourceware.org/viewvc/ecos/packages/services/objloader/current/src/objelf.c?view=markup#l62 Look up example, objelf.c:cyg_ldr_external_address(): https://sourceware.org/viewvc/ecos/packages/services/objloader/current/src/objelf.c?view=markup#l219 Sergei -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss