karosium / smbusb

USB SMBus Interface
GNU Lesser General Public License v2.1
141 stars 42 forks source link

TODO: Support for newer sdcc versions #25

Closed karosium closed 3 years ago

karosium commented 3 years ago

Looks like updating the fx2lib submodule lets the firmware build with the latest sdcc but would break compatibility with older versions which I assume a lot of people still have.

Quick fix if the firmware doesn't build with your SDCC (probably versions 3.8 and up):

cd fx2lib
git checkout master
jjakob commented 3 years ago

fx2lib.patch didn't apply to fx2lib master so here is the corrected fx2lib.patch:

diff --git a/lib/fx2.mk b/lib/fx2.mk
index 501040f..359a698 100644
--- a/lib/fx2.mk
+++ b/lib/fx2.mk
@@ -41,15 +41,15 @@ VID?=0x04b4
 PID?=0x8613

 INCLUDES?=""
-DSCR_AREA?=-Wl"-b DSCR_AREA=0x3e00"
-INT2JT?=-Wl"-b INT2JT=0x3f00"
+DSCR_AREA?=-Wl"-b DSCR_AREA=0x1e00"
+INT2JT?=-Wl"-b INT2JT=0x1f00"
 CC=sdcc
 # these are pretty good settings for most firmwares.
 # Have to be careful with memory locations for
 # firmwares that require more xram etc.
-CODE_SIZE?=--code-size 0x3c00
+CODE_SIZE?=--code-size 0x1c00
 XRAM_SIZE?=--xram-size 0x0200
-XRAM_LOC?=--xram-loc 0x3c00
+XRAM_LOC?=--xram-loc 0x1c00
 BUILDDIR?=build

 FX2LIBDIR?=$(dir $(lastword $(MAKEFILE_LIST)))../
jjakob commented 3 years ago

and the diff for the smbusb tree

diff --git a/fx2lib b/fx2lib
index aaa470e..ab74f75 160000
--- a/fx2lib
+++ b/fx2lib
@@ -1 +1 @@
-Subproject commit aaa470e377ca0bf861244b10cdf4bdc4615d8bc1
+Subproject commit ab74f750a4074e0527c8b6d0b149d0756d4dd96d-dirty
diff --git a/fx2lib.patch b/fx2lib.patch
index cbafde6..76a909b 100644
--- a/fx2lib.patch
+++ b/fx2lib.patch
@@ -1,16 +1,20 @@
 diff --git a/lib/fx2.mk b/lib/fx2.mk
-index d876a6d..c404ce0 100644
+index 501040f..359a698 100644
 --- a/lib/fx2.mk
 +++ b/lib/fx2.mk
-@@ -41,11 +41,11 @@ VID?=0x04b4
+@@ -41,15 +41,15 @@ VID?=0x04b4
  PID?=0x8613

  INCLUDES?=""
 -DSCR_AREA?=-Wl"-b DSCR_AREA=0x3e00"
 -INT2JT?=-Wl"-b INT2JT=0x3f00"
--CODE_SIZE?=--code-size 0x3c00
 +DSCR_AREA?=-Wl"-b DSCR_AREA=0x1e00"
 +INT2JT?=-Wl"-b INT2JT=0x1f00"
+ CC=sdcc
+ # these are pretty good settings for most firmwares.
+ # Have to be careful with memory locations for
+ # firmwares that require more xram etc.
+-CODE_SIZE?=--code-size 0x3c00
 +CODE_SIZE?=--code-size 0x1c00
  XRAM_SIZE?=--xram-size 0x0200
 -XRAM_LOC?=--xram-loc 0x3c00
karosium commented 3 years ago

Configure will detect SDCC version now and do what's necessary. Thanks for the patches @jjakob