flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > flat binaries with Dev-C++

Author
Thread Post new topic Reply to topic
AmbroXio



Joined: 09 Jan 2007
Posts: 13
Location: Guatemala
AmbroXio 13 Jan 2007, 19:15
Hi there !....

... well, i would really like to do flat binaries with Dev C++, i've seen a pdf that explains how to do that with GCC..

http://www.nondot.org/sabre/os/files/Booting/CompilingBinaryFilesUsingACompiler.pdf

.. and i believe Dev-C++ and GCC aren't different at all ?.. am i wrong ?....... anyway, i have no idea about, how to do that....... could anyone please help with these ? ! ..... i know where the compiler and the linker arguments should be using dev c, but ..... well, you'll better see that pdf to get me clear...
Post 13 Jan 2007, 19:15
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
AmbroXio



Joined: 09 Jan 2007
Posts: 13
Location: Guatemala
AmbroXio 13 Jan 2007, 19:40
after a little research, i've found one problem with that pdf, the dev c linker seems to get wrong the option

-oformat binary

and it takes as if we were saying

-o format

so the output file is called "format" .... i saw in some ld manual that these option is actually

--oformat (with two '-')

but dev c linker does not recognizes it (sorry about my bad english in any case...)
Post 13 Jan 2007, 19:40
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 841
Location: Jakarta, Indonesia
TmX 14 Jan 2007, 04:47
Dev-C++ is just the GUI IDE
Dev-C++ itself uses MinGW GCC as it's compiler
Post 14 Jan 2007, 04:47
View user's profile Send private message Reply with quote
AmbroXio



Joined: 09 Jan 2007
Posts: 13
Location: Guatemala
AmbroXio 14 Jan 2007, 23:33
well.... TmX, thanks for the info.. i guess..... anyway, i think there's some kind of bug with dev-c++, because it changes "--oformat" to "-foformat" ......

... so I deicded to do this using a script ...

Code:
@ECHO OFF

IF "%2" == "" goto noparam

C:\Dev-Cpp\bin\gcc.exe -c %1 -o temp.o
C:\Dev-Cpp\bin\ld.exe temp.o -o %2 -Ttext 0x0 -e main --oformat binary

del temp.o

goto end

:noparam

ECHO.
ECHO Escrito por Guillermo Ambrosio (14/01/2007)
ECHO.
ECHO Script generador de binarios usando GCC y LD
ECHO Uso :
ECHO       BINMAKER  [archivo de entrada] [nombre de archivo de salida]
ECHO.

:end
    


these are the important lines:

C:\Dev-Cpp\bin\gcc.exe -c %1 -o temp.o
C:\Dev-Cpp\bin\ld.exe temp.o -o %2 -Ttext 0x0 -e main --oformat binary

i tried it, but this gives me these messages:

Code:

C:\Documents and Settings\Guillermo\Escritorio\HISPAOS>binmaker prueba.c prueba.bin

C:\Dev-Cpp\bin\ld.exe: warning: cannot find entry symbol main; defaulting to 00000000
temp.o(.text+0x21):prueba.c: undefined reference to `_alloca'
temp.o(.text+0x26):prueba.c: undefined reference to `__main'
    


why doesnt it "finds" 'main' symbol ???...... and what's that about the undefined references ??..... i hope someone helps me.....

un saludo!..
Post 14 Jan 2007, 23:33
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
nimday



Joined: 27 Apr 2014
Posts: 1
Location: Java , Indonesia
nimday 22 May 2014, 21:56
you can do that with this,change main to start
Code:
int start () {
 int i; /* declaration of an int */
 i = 0x12345678; /* hexadecimal */
}    

Code:
gcc -c test.c
ld -o test -Ttext 0x0 -e main test.o
objcopy -R .note -R .comment -S -O binary test test.bin    
Post 22 May 2014, 21:56
View user's profile Send private message Reply with quote
badc0de02



Joined: 25 Nov 2013
Posts: 215
Location: %x
badc0de02 22 May 2014, 22:05
dev gcc uses mingw gcc/g++

if you dont want the devcpp platform just install mingw
Post 22 May 2014, 22:05
View user's profile Send private message Reply with quote
badc0de02



Joined: 25 Nov 2013
Posts: 215
Location: %x
badc0de02 22 May 2014, 22:09
but one aleread tell that and you guessed Mad
Post 22 May 2014, 22:09
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 339
Location: Asia, Singapore
sid123 22 May 2014, 23:58
You must use a linker script for linking all the object files to a binary file. I'm not sure why you're doing this because binary format is *plain stupid*. Neither they contain any information about the executable, uninitialized variables turn into 0's which takes a lot of space.....
Post 22 May 2014, 23:58
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 23 May 2014, 16:46
sid123 wrote:
... because binary format is *plain stupid*. Neither they contain any information about the executable, uninitialized variables turn into 0's which takes a lot of space.....
If you are making a ROM or some boot code then the only way is with binary. And let's not forget about the old favourite DOS COM files.
Post 23 May 2014, 16:46
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.