How do I get a map file within arm-none-eabi-gcc - gcc

Deal All,
I'm trying to get a map file with arm-none-eabi-gcc.
I came across one error message what "no such file or directory" when I run the below command.
arm-none-eabi-gcc -g hello.c -o hello -Wl,-Map mapfile.txt
arm-none-eabi-gcc: error: mapfile.txt: No such file or directory
Would you please help me how can I get the map file What am I supposed to do to resolve this problem?

I found my fault from http://thehackerworkshop.com/?p=443 ,
arm-none-eabi-gcc -g hello.c -o hello -Wl,-Map=hello.map
$(USER_DEFINE) -T $(LINKER_SCRIPT) -o $(BOOTLOADER).o -Wl,-Map=$(BOOTLOADER).map
it's work

Related

How to run the "make" command for YoloV3 Darknet (for Windows)?

After running the ./make.exe command (By using GNUWin32), I get the following error:
mkdir -p obj
mkdir -p backup
A subdirectory or file -p already exists.
Error occurred while processing: -p. make: *** [backup] Error 1
After rerunning the command, I get a different error:
mkdir -p results
A subdirectory or file -p already exists.
Error occurred while processing: -p.
make: *** [results] Error 1
Then I get the same error no matter how many times I repeat the make command:
gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2
As I am a beginner, can you please provide detailed instructions on how I can fix the problem?
These problems:
mkdir -p obj
mkdir -p backup
A subdirectory or file -p already exists.
Error occurred while processing: -p. make: *** [backup] Error 1
are caused by the fact that you have asked Make to execute, on Windows,
a makefile that was written to work on Linux or some other Unix-like operating system.
In Unix-like operating systems, the command:
mkdir -p obj
means: Create a directory called obj with no error if it already exists. In
Windows it means: Create a directory called -p and then a directory called obj.
So when mkdir -p obj has created the directories -p and obj, the command:
mkdir -p backup
fails because:
A subdirectory or file -p already exists.
The Unix/Linux makefile has no intention of creating a directory called -p, but on Windows
that is what it does.
There is little point in your attempting to fix this specific error. It is just the
first of indefinitely many errors that will result from attempting to execute a Unix/Linux
makefile on Windows. You need a makefile that was written to run on
Windows, or to write one yourself, or to find a way of building the software on Windows that does not use Make.
This problem:
gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o
process_begin: CreateProcess(NULL, gcc -Iinclude/ -Isrc/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -c ./src/gemm.c -o obj/gemm.o, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/gemm.o] Error 2
is caused by the fact that you have not installed the GCC C compiler
gcc on your computer, or if you have, the directory where it resides is not in your PATH. So Make cannot find
it to perform the essential business of compiling and linking your software.
Here is a popular Windows port of GCC
Your makefile has been written for Linux and is not directly portable to Windows.
The issue is that ‘mkdir’ is conflicting with CMD’s built-in function that doesn’t support the same command line options (as explained by Mike Kinghan).
A simple workaround is to replace any occurrence of mkdir in your makefile with $(MKDIR) and to add at the very beginning:
MKDIR := “$(shell which mkdir)”
Of course this requires that you install which and CoreUtils (that provides mkdir). Note the double quotes to avoid any issues with white space on the path to mkdir.
Last but not least you will also need gcc which you can get here or there for example.

Error trying to exec 'cc1': execvp: No such file or directory. Directory pointed explicitly

I got the following error :
arm-none-eabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
I do not how to solve it because I explicitly tell gcc where to search. I call:
arm-none-eabi-gcc -Wall -std=c99 -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -I/home/charlie/projects/epsionic-nrf/Inc -c Src/Clock.c -o Obj/Debug/Clock.o -L/home/charlie/arm-none-eabi/lib
I know that cc1 is inside the following directory:
/home/charlie/arm-none-eabi/lib
I have already checked if GCC_EXEC_PREFIX is defined in my environment but it is not.
Does anyone know what the issue is?

g++ linker options changes target file name

I need help it is bug or I don't understand how compilation options are working ?
I have sample main.c file and try to compile it as:
$ g++ -nostdlib -g -fno-rtti -fno-exceptions -ffreestanding -nostdinc -nostdinc++ -Wl,--build-id=none,-g,-nostdlib,-nostartfiles,-zmax-page-size=0x1000 main.c -o main
and as output I have this:
$ ls
main.c startfiles
I am trying to understand why g++ created file named "startfiles" not "main" ?
If you read the GNU ld official documentation you will see that there is no option named -nostartfiles. What you do pass for arguments to the linker with that is the options -n and -ostartfiles.
If I were you, I would check those other options you try to pass to the linker as well.
-nostartfiles is a compiler flag as far as I know, not a linker flag.
For the linker, it's the same as -n -o startfiles, which is why you're getting that output file name.

How do I link with gcc on MinWG

Is this syntax incorrect?
C:\Users\Brett\Compilers>gcc -I MinGW\include -l MinGW\lib\libgdi32.a -o hello
world helloworld.c
The directory's are all fine, I mist be including and linking in the wrong order or something?
Here is the output:
c:/users/Brett/compilers/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw
2/bin/ld.exe: cannot find -lMinGW\lib\libgdi32.a
collect2: ld returned 1 exit status
The syntax for -l switch is the library name without lib prefix and without the extension. If it cannot be found, it's directory should be given with -L option. So I would write:
gcc -I MinGW\include -L MinGW\lib -lgdi32 -o helloworld helloworld.c
Maybe -L is not needed, maybe you also need -mwindows to tell the linker you want windows app. To specify a library file explicitly, give it without any letter option, like this:
gcc -I MinGW\include MinGW\lib\libgdi32.a -o helloworld helloworld.c
Here is the gcc reference: linking options.

make library not found

I'm trying to compile a program using a third party library, Omnet++ in my case. Apparently "make" does not find a library, but the path it uses is correct as you can see (in the sense that I can see the library under omnet++ source tree)
pv135168:basic Bob$ opp_makemake
Creating Makefile in /Users/Bob/Code/network_sim/basic... Makefile created, running "make depend" to add dependencies... opp_makedep -Y --objdirtree -I. -f Makefile -P\$O/ -- ./*.cc
pv135168:basic Bob$ make
g++ -c -g -Wall
-fno-stack-protector -m32 -DHAVE_PCAP -DXMLPARSER=libxml
-DWITH_PARSIM -DWITH_NETBUILDER -I.
-I/Users/Bob/Code/omnetpp-4.1/include -o out/gcc-debug//txc1.o txc1.cc g++ -m32 -Wl,-rpath,/Users/Bob/Code/omnetpp-4.1/lib -Wl,-rpath,. -o out/gcc-debug//basic out/gcc-debug//txc1.o -Wl,-all_load
-L"/Users/Bob/Code/omnetpp-4.1/lib/gcc"
-L"/Users/Bob/Code/omnetpp-4.1/lib" -u _tkenv_lib -lopptkenvd
-loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird
-loppsimd -lstdc++
ld: library not found for -lopptkenvd
collect2: ld returned 1 exit status make: *** [out/gcc-debug//basic]
Error 1 pv135168:basic Bob$
It's looking in the following directories for a file called libopptkenvd.dylib or libopptkenvd.a:
/Users/Bob/Code/omnetpp-4.1/lib/gcc
/Users/Bob/Code/omnetpp-4.1/lib
Is that file in one of those directories (or in the standard directories like /usr/lib)? I don't see an indication of that in your output.

Resources