Hi all,
Using GNU linker ld, I'd like to create a section .rom_code
grouping
some routines and all its dependencies, including the implicit called
ones such as math routines provided by libm.a. Going down in more
details, my intention is creating a stand-alone ROM image containing
several utility routines (with all its dependencies) that will be used
by programs loaded in RAM.
The C code is something like:
% cat test.c <<HERE
#include <stdio.h>
#include <math.h>
void _start() { main(); }
extern int main();
volatile float a, b, c;
volatile float res;
__attribute__(( section(".rom_c ode"))) void rom_function();
void rom_function() {
c = a / b; // Use implicitely libm.a routine
res = sin(c); // Use explictly libm.a routine
}
int main() {
rom_function();
return 0;
}
HERE
% gcc -g test.c -lm -Wl,-T lib.lnk
Compiling and linking in the usual way, only the rom_function()
went to ROM, not its dependencies. These are the references
to .rom_code section, only the
rom_function() routine can be found there:
% objdump -x a.out | grep rom_code
7 .rom_code 00000070 00008000 00008000 00018000 2**2
00008000 l d .rom_code 00000000
00008000 g F .rom_code 00000070 rom_function
The sin() was placed in .text and not in .rom_code:
% objdump -x a.out | grep sin
00000000 l df *ABS* 00000000 s_sin.c
00000000 l df *ABS* 00000000 k_sin.c
00001438 g F .text 000000f8 __kernel_sin
00000514 g F .text 000000ec sin
The linker script used is:
MEMORY
{
RAM_CODE : o = 0x0000 , l = 0x8000
ROM_CODE : o = 0x8000 , l = 0x8000
}
SECTIONS
{
.bss : { *(.bss) } RAM_CODE
.sbss : { *(.sbss) } RAM_CODE
.rodata : { *(.rodata*) } RAM_CODE
.got2 : { *(.got*) } RAM_CODE
.data : { *(.data) } RAM_CODE
.sdata : { *(.sdata*) } RAM_CODE
.text : { *(.text .text.*) } RAM_CODE
.rom_code : { *(.rom_code) } ROM_CODE
}
Any ideas on how to put also the rom_function() dependencies into
ROM?
Tks
Walter 1 1697
On Thu, 27 Mar 2008 10:02:17 -0700 (PDT), wy******@yahoo. com.br wrote
in comp.lang.c:
Hi all,
Using GNU linker ld, I'd like to create a section .rom_code
grouping
some routines and all its dependencies, including the implicit called
ones such as math routines provided by libm.a. Going down in more
details, my intention is creating a stand-alone ROM image containing
several utility routines (with all its dependencies) that will be used
by programs loaded in RAM.
The C code is something like:
[snip]
Your question has nothing at all to do with the C language, and
everything to do with your particular tool set and target. C does not
have ROM images or sections.
You need to ask this question in a GNU support group, or, since you
mention ROM, perhaps in news:comp.arch. embedded where such questions
for embedded system development are topical. But if you ask there,
you had better provide more information, such as the target and
version of the tools.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: adeht |
last post by:
In his book, "Modern C++ Design", Andrei Alexandrescu presents a Generic
Object Factory class (Loki::Factory). One of its advantages (also mentioned
in
the book) is being able to register the class in the factory without having
a
central place that needs to be modified each time we add a new type. For
example, the registration can be done in the same compilation unit as the
class implementation:
(code like this has been presented in...
|
by: Leslaw Bieniasz |
last post by:
Cracow, 20.09.2004
Hello,
I need to implement a library containing a hierarchy of classes
together with some binary operations on objects. To fix attention,
let me assume that it is a hierarchy of algebraic matrices with the
addition operation. Thus, I want to have a virtual base class
class Matr;
|
by: Jakob Bieling |
last post by:
Hi,
I am aware of the fact, that the order of construction of global
objects is unspecified. But I am in a situation, where I need to
guarantee, that one object is created before others (not all others,
just all objects of a specified type). I came up with the following
solution, but I am not sure, if it does solve my problem:
class first
{
|
by: vince |
last post by:
Can I add (append) to an xml file that already contains a
serialized object, and be able to deserialize to either
or both objects from the same file...??? How is this
done...??
thanks,
vince
|
by: Nashat Wanly |
last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaskdr/html/askgui06032003.asp
Don't Lock Type Objects!
Why Lock(typeof(ClassName)) or SyncLock GetType(ClassName) Is Bad
Rico Mariani, performance architect for the Microsoft® .NET runtime
and longtime Microsoft developer, mentioned to Dr. GUI in an e-mail
conversation recently that a fairly common practice (and one that's,
unfortunately, described in some of our...
| |
by: Bonj |
last post by:
can you embed a resource into a static libary?
I'm using a custom binary resource specified as a .bin file in the .rc file
of the static library project I've got. I use FindResource, LoadResource,
LockResource to get the resource. However FindResource is returning null. If
I use exactly the same code to retrieve a resource out of the resource of
the console application used to test the static library, then it works
perfectly. I can't see...
|
by: Adam |
last post by:
I have a managed cpp wrapper. Im using this in a native dll as a static
variable. I need to free this library when the dll is done being used. The
perfect place to do this is DllMain for DLL_PROCESS_DETACH, but I can't do
this when touching managed code, even if its just calling "delete
someObject;". Any recommendations on how to free this object (it needs to be
freed when the dll is being unloaded from its caller). Since the CRT is...
|
by: Fuehner |
last post by:
Everyone--
I installed the .NET 2.0 framework on a server that also has version 1.1
installed. A few of my applications override the "appSettings" section in the
web.config with a custom config handler.
This all worked fine prior to installing the 2.0 framework but, now I get
the following error...
Section or group name 'appSettings' is already defined. Updates to this may
|
by: George Copeland |
last post by:
This is a request for assistance analyzing a problem we are experiencing in
our VB6 development environment. All our code is developed in VB6, and our
persistance layer is SQL Server. We are planning to convert this project to
dot net sometime in the future.
Our architecture is an exe project with references to four business object
dlls. Also, each one of our tables is encapsulated in a data object dll.
The data objects are referenced...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |