Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a recent Hex2bin for Linux #9

Closed
ghost opened this issue Dec 11, 2020 · 6 comments
Closed

Need a recent Hex2bin for Linux #9

ghost opened this issue Dec 11, 2020 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 11, 2020

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)
@ericb59
Copy link
Owner

ericb59 commented Dec 11, 2020 via email

@ghost
Copy link
Author

ghost commented Dec 11, 2020

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
Copy link
Owner

ericb59 commented Dec 11, 2020

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
Copy link
Author

ghost commented Dec 12, 2020

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

@ghost ghost changed the title Building test.c fails Need a recent Hex2bin for Linux Dec 12, 2020
@ericb59
Copy link
Owner

ericb59 commented Dec 12, 2020

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
Copy link
Author

ghost commented Dec 12, 2020

I could build by patching all the header files and putting extern in front of all globals, see bitcraze/crazyflie-firmware#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!

@ghost ghost closed this as completed Dec 12, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant