ericb59 / Fusion-C-v1.2

MSX C Library for SDCC compiler
Other
71 stars 7 forks source link

Need a recent Hex2bin for Linux #9

Closed ghost closed 3 years ago

ghost commented 3 years ago

make fails after this output:

..•̀ᴗ•́)و .. sdcc                                            is Processing ... !
Invalid input and output values
usage: hex2bin [options]
    --help, -h: Print this help
    --input, -i: The input file to use (containing the hexadecimal characters).
    --output, -o: The output file to use.
    --limit, -l: Character limit per line (the value of the "start" option is not included).
    --start, -s: Adding a start offset per line.
    --printable, -p: Extracts and converts all printable characters.
    --extract_only, -e: Only extracts words from "start" to "limit".
make: *** [Makefile:83: test.com] Fout 1**

Using:

ericb59 commented 3 years ago

Hello,

Your problem comes from the HEX2BIN version you are using. Please try with this one : https://sourceforge.net/projects/hex2bin/

Le ven. 11 déc. 2020 à 11:20, Mister Wrong notifications@github.com a écrit :

make fails after this output:

..•̀ᴗ•́)و .. sdcc is Processing ... !

Invalid input and output values

usage: hex2bin [options]

--help, -h: Print this help

--input, -i: The input file to use (containing the hexadecimal characters).

--output, -o: The output file to use.

--limit, -l: Character limit per line (the value of the "start" option is not included).

--start, -s: Adding a start offset per line.

--printable, -p: Extracts and converts all printable characters.

--extract_only, -e: Only extracts words from "start" to "limit".

make: * [Makefile:83: test.com] Fout 1

Using:

  • OS: Linux 5.9.13-arch1-1
  • SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.0.0 #11528 (Linux) with printf, sprintf, vprintf, putchar, getchar removed
  • hex2bin: git://github.com/Keidan/hex2bin.git, master (commit a8de8c406ec4e4cdc08f646bd03f38377330854a)
  • Fusion-C: master (commit 184582a https://github.com/ericb59/Fusion-C-v1.2/commit/184582a7bb300d1f5fa49f48c258f9816be9e4ab )

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ericb59/Fusion-C-v1.2/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJIPCUIJRZGSHDYHGWJ7VCTSUHW7ZANCNFSM4UWNKSHA .

ghost commented 3 years ago

I'm afraid that one doesn't build:

gcc -c -std=c99 -O2 -Wall -pedantic hex2bin.c -o hex2bin.o
hex2bin.c: In functie ‘main’:
hex2bin.c:212:17: let op: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  212 |                 if (temp > Highest_Address)
      |                 ^~
hex2bin.c:214:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  214 |                     if (Verbose_Flag) fprintf(stderr,"Highest_Address: %08X\n",Highest_Address);
      |                     ^~
gcc -c -std=c99 -O2 -Wall -pedantic common.c -o common.o
gcc -c -std=c99 -O2 -Wall -pedantic libcrc.c -o libcrc.o
gcc -c -std=c99 -O2 -Wall -pedantic binary.c -o binary.o
gcc -O2 -Wall -o hex2bin hex2bin.o common.o libcrc.o binary.o
/usr/bin/ld: common.o:(.data+0xc): multiple definition of `Pad_Byte'; hex2bin.o:(.bss+0xa4): first defined here
/usr/bin/ld: common.o:(.bss+0x38): multiple definition of `Batch_Mode'; hex2bin.o:(.bss+0x3c): first defined here
/usr/bin/ld: common.o:(.bss+0xa0): multiple definition of `Filin'; hex2bin.o:(.bss+0xb0): first defined here
/usr/bin/ld: common.o:(.bss+0x98): multiple definition of `Filout'; hex2bin.o:(.bss+0xa8): first defined here
/usr/bin/ld: common.o:(.bss+0x88): multiple definition of `Checksum'; hex2bin.o:(.bss+0x98): first defined here
/usr/bin/ld: common.o:(.bss+0x90): multiple definition of `Enable_Checksum_Error'; hex2bin.o:(.bss+0xa0): first defined here
/usr/bin/ld: common.o:(.bss+0x84): multiple definition of `Record_Nb'; hex2bin.o:(.bss+0x94): first defined here
/usr/bin/ld: common.o:(.bss+0x8c): multiple definition of `Status_Checksum_Error'; hex2bin.o:(.bss+0x9c): first defined here
/usr/bin/ld: common.o:(.bss+0x4c): multiple definition of `Floor_Address_Setted'; hex2bin.o:(.bss+0x50): first defined here
/usr/bin/ld: common.o:(.bss+0x48): multiple definition of `Ceiling_Address_Setted'; hex2bin.o:(.bss+0x4c): first defined here
/usr/bin/ld: common.o:(.bss+0x5c): multiple definition of `Floor_Address'; hex2bin.o:(.bss+0x60): first defined here
/usr/bin/ld: common.o:(.data+0x4): multiple definition of `Ceiling_Address'; hex2bin.o:(.bss+0x64): first defined here
/usr/bin/ld: common.o:(.bss+0x2c): multiple definition of `Cks_Type'; hex2bin.o:(.bss+0x30): first defined here
/usr/bin/ld: common.o:(.data+0x0): multiple definition of `Crc_Poly'; hex2bin.o:(.bss+0x10): first defined here
/usr/bin/ld: common.o:(.bss+0xc): multiple definition of `Crc_Init'; hex2bin.o:(.bss+0xc): first defined here
/usr/bin/ld: common.o:(.bss+0x8): multiple definition of `Crc_XorOut'; hex2bin.o:(.bss+0x8): first defined here
/usr/bin/ld: common.o:(.bss+0x20): multiple definition of `Cks_Addr'; hex2bin.o:(.bss+0x24): first defined here
/usr/bin/ld: common.o:(.bss+0x74): multiple definition of `Lowest_Address'; hex2bin.o:(.bss+0x80): first defined here
/usr/bin/ld: common.o:(.bss+0x30): multiple definition of `Endian'; hex2bin.o:(.bss+0x34): first defined here
/usr/bin/ld: common.o:(.bss+0x78): multiple definition of `Memory_Block'; hex2bin.o:(.bss+0x88): first defined here
/usr/bin/ld: common.o:(.bss+0x10): multiple definition of `Force_Value'; hex2bin.o:(.bss+0x14): first defined here
/usr/bin/ld: common.o:(.bss+0x70): multiple definition of `Highest_Address'; hex2bin.o:(.bss+0x7c): first defined here
/usr/bin/ld: common.o:(.bss+0x60): multiple definition of `Max_Length'; hex2bin.o:(.bss+0x6c): first defined here
/usr/bin/ld: common.o:(.bss+0x54): multiple definition of `Minimum_Block_Size_Setted'; hex2bin.o:(.bss+0x58): first defined here
/usr/bin/ld: common.o:(.bss+0x14): multiple definition of `Cks_Addr_set'; hex2bin.o:(.bss+0x18): first defined here
/usr/bin/ld: common.o:(.data+0x8): multiple definition of `Minimum_Block_Size'; hex2bin.o:(.bss+0x68): first defined here
/usr/bin/ld: common.o:(.bss+0x58): multiple definition of `Module'; hex2bin.o:(.bss+0x5c): first defined here
/usr/bin/ld: common.o:(.bss+0x18): multiple definition of `Cks_range_set'; hex2bin.o:(.bss+0x1c): first defined here
/usr/bin/ld: common.o:(.bss+0x28): multiple definition of `Cks_Start'; hex2bin.o:(.bss+0x2c): first defined here
/usr/bin/ld: common.o:(.bss+0x24): multiple definition of `Cks_End'; hex2bin.o:(.bss+0x28): first defined here
/usr/bin/ld: common.o:(.bss+0x1c8): multiple definition of `crc_table'; hex2bin.o:(.bss+0x1e8): first defined here
/usr/bin/ld: common.o:(.bss+0x44): multiple definition of `Max_Length_Setted'; hex2bin.o:(.bss+0x48): first defined here
/usr/bin/ld: common.o:(.bss+0x1c): multiple definition of `Cks_Value'; hex2bin.o:(.bss+0x20): first defined here
/usr/bin/ld: common.o:(.bss+0x4): multiple definition of `Crc_RefIn'; hex2bin.o:(.bss+0x4): first defined here
/usr/bin/ld: common.o:(.bss+0x50): multiple definition of `Starting_Address_Setted'; hex2bin.o:(.bss+0x54): first defined here
/usr/bin/ld: common.o:(.bss+0x64): multiple definition of `Records_Start'; hex2bin.o:(.bss+0x70): first defined here
/usr/bin/ld: common.o:(.bss+0x6c): multiple definition of `Starting_Address'; hex2bin.o:(.bss+0x78): first defined here
/usr/bin/ld: common.o:(.bss+0x80): multiple definition of `Nb_Bytes'; hex2bin.o:(.bss+0x90): first defined here
/usr/bin/ld: common.o:(.bss+0x68): multiple definition of `Phys_Addr'; hex2bin.o:(.bss+0x74): first defined here
/usr/bin/ld: common.o:(.bss+0x40): multiple definition of `Swap_Wordwise'; hex2bin.o:(.bss+0x44): first defined here
/usr/bin/ld: common.o:(.bss+0x34): multiple definition of `Verbose_Flag'; hex2bin.o:(.bss+0x38): first defined here
/usr/bin/ld: common.o:(.bss+0xb0): multiple definition of `Extension'; hex2bin.o:(.bss+0xc0): first defined here
/usr/bin/ld: common.o:(.bss+0x3c): multiple definition of `Address_Alignment_Word'; hex2bin.o:(.bss+0x40): first defined here
/usr/bin/ld: common.o:(.bss+0x0): multiple definition of `Crc_RefOut'; hex2bin.o:(.bss+0x0): first defined here
/usr/bin/ld: common.o:(.bss+0xc0): multiple definition of `Filename'; hex2bin.o:(.bss+0xe0): first defined here
/usr/bin/ld: libcrc.o:(.bss+0x0): multiple definition of `crc_table'; hex2bin.o:(.bss+0x1e8): first defined here
collect2: fout: ld gaf exit-status 1 terug
make: *** [Makefile:23: hex2bin] Fout 1

Using gcc versie 10.2.0 (GCC)

ericb59 commented 3 years ago

Too bad ! Ok so with your other Hex2Bin version you need to Edit and modify the Fusion-c Compilation script. Open the makefile, and identify the line with the hex2bin function. you must see this : @hex2bin -e com $^ @cp $@ $(DEST)

Modify it, to match the command arguments needed by your Hex2bin. it must be something like this: hex2bin -I $^ -o output.com @cp output.com $(DEST)

The final file's name on the MSX side will be "output.com"

I'm not expert in linux and Makefile edition. So , I hope it can works.

ghost commented 3 years ago

The changes to the Makefile you provided seemed work, but the hex2bin I'm using does not seem to provide a file that when ran on an MSX responds with the expected output (attached). I have changed this issue to finding a suitable hex2bin that will work on modern Linux platforms.

output.com.gz

ericb59 commented 3 years ago

Yes, this .com does't seems to work. it's really weird that the standard version of Hex2bin doesn't work on your distribution. Unfortunately I don't know how to fix the problem. Try asking the Linux community for a solution? Or maybe posting to WWW.MSX.ORG, maybe someone already has a solution?

ghost commented 3 years ago

I could build by patching all the header files and putting extern in front of all globals, see https://github.com/bitcraze/crazyflie-firmware/issues/613

This was suggested to me by several member of msx.org (https://www.msx.org/forum/msx-talk/development/cant-build-hex2bin-on-linux). The patch is also in that thread.

Since the hex2bin version used by this projects seems to be unmaintained, is it possible for you to adopt the patched version here? If not, you can always refer people to the thread mentioned.

Thanks!