Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By Sprite_tm
#175 As far as I can see, that script is needed but doesn't solve the problem: due to some braindeadness the crosstool-ng still won't pick it up. I hacked it to pick it up anyway:
Code: Select alldiff --git a/scripts/build/arch/xtensa.sh b/scripts/build/arch/xtensa.sh
index 09a27a2..2c46bab 100644
--- a/scripts/build/arch/xtensa.sh
+++ b/scripts/build/arch/xtensa.sh
@@ -22,7 +22,6 @@ CT_ConfigureXtensa() {
         custom_overlay="xtensa-overlay.tar"
     fi
 
-    local full_file="${CT_TARBALLS_DIR}/${custom_overlay}"
     local basename="${component}-${version}"
     local ext
 
@@ -34,24 +33,31 @@ CT_ConfigureXtensa() {
              custom_location="${CT_CUSTOM_LOCATION_ROOT_DIR}"
     fi
 
-    if ! ext="$(CT_GetFileExtension "${basename}")"; then
-        CT_DoLog WARN "'${basename}' not found in '${CT_TARBALLS_DIR}'"
-        return 1
-    fi
+   #From here on, ${custom_location}/${custom_overlay} should point to the overlay file.
+    local full_file="${custom_location}/${custom_overlay}"
 
-    if [ -e "${CT_SRC_DIR}/.${basename}.configuring" ]; then
-        CT_DoLog ERROR "The '${basename}' source were partially configured."
-        CT_DoLog ERROR "Please remove first:"
-        CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'"
-        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'"
-        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patch'"
-        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.configuring'"
-        CT_Abort
-    fi
+   #No idea. - JD
+#    if ! ext="$(CT_GetFileExtension "${basename}")"; then
+#        CT_DoLog WARN "'${basename}' not found in '${CT_TARBALLS_DIR}'"
+#        return 1
+#    fi
+
+
+   #This seems to always trigger during a normal run. Commented out for now. -JD
+#    if [ -e "${CT_SRC_DIR}/.${basename}.configuring" ]; then
+#        CT_DoLog ERROR "(xtensa.sh) The '${basename}' source were partially configured."
+#        CT_DoLog ERROR "Please remove first:"
+#        CT_DoLog ERROR " - the source dir for '${basename}', in '${CT_SRC_DIR}'"
+#        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.extracted'"
+#        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.patch'"
+#        CT_DoLog ERROR " - the file '${CT_SRC_DIR}/.${basename}.configuring'"
+#        CT_Abort
+#    fi
 
-    CT_DoLog EXTRA "Using '${custom_config}' from ${custom_location}"
-    CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_config}" \
-                              "${CT_TARBALLS_DIR}/${custom_config}"
+    CT_DoLog EXTRA "Using '${custom_overlay}' from ${custom_location}"
+   #Is this good for anything? -JD
+#    CT_DoExecLog DEBUG ln -sf "${custom_location}/${custom_overlay}" \
+#                              "${CT_TARBALLS_DIR}/${custom_overlay}"
 
     CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configuring"
 
@@ -60,16 +66,16 @@ CT_ConfigureXtensa() {
     tar_opts=( "--strip-components=1" )
     tar_opts+=( "-xv" )
 
-    case "${ext}" in
-        .tar)           CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}" "${component}";;
-        .tar.gz|.tgz)   gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}";;
-        *)              CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
+    case "${full_file}" in
+        *.tar)           CT_DoExecLog FILE tar "${tar_opts[@]}" -f "${full_file}" "${component}";;
+        *.tar.gz|.tgz)   gzip -dc "${full_file}" | CT_DoExecLog FILE tar "${tar_opts[@]}" -f - "${component}";;
+        *)              CT_DoLog WARN "Don't know how to handle '${full_file}': '${ext}': unknown extension"
                         return 1
                         ;;
     esac
 
-    CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configured"
-    CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.configuring"
+#    CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.configured"
+#    CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.configuring"
 
     CT_Popd
 }
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 5d3734f..dafbb6a 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -38,7 +38,7 @@ do_binutils_extract() {
         CT_Patch "elf2flt" "${CT_ELF2FLT_VERSION}"
     fi
 
-    if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
+    if [ -n "${CT_XTENSA_CUSTOM}" ]; then
    CT_ConfigureXtensa "binutils" "${CT_BINUTILS_VERSION}"
     fi
 }
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index e0b0e8e..fcb47b9 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -59,7 +59,7 @@ do_cc_extract() {
         CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar"
     fi
 
-   if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
+   if [ -n "${CT_XTENSA_CUSTOM}" ]; then
       CT_ConfigureXtensa "gcc" "${CT_CC_VERSION}"
    fi
 }
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index b10f910..7bc33b8 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -94,7 +94,7 @@ do_debug_gdb_extract() {
         CT_Patch "expat" "${CT_DEBUG_GDB_EXPAT_VERSION}"
     fi
 
-    if [ -n "${CT_ARCH_XTENSA_CUSTOM_OVERLAY_FILE}" ]; then
+    if [ -n "${CT_XTENSA_CUSTOM}" ]; then
         CT_ConfigureXtensa "gdb" "${CT_GDB_VERSION}"
     fi
 }

but that gives other problems: the compiler now spits out instructions binutils assembler doesn't understand.
User avatar
By Sprite_tm
#179 To be honest, apart from all the madness of getting crosstool-ng to actually build with the overlay, I think the overlay itself may be broken or incompatible with gcc. I have tried crosstool-ng and building my own toolchain, with the most recent gcc/binutils (2.22 and 4.9) and with a binutils/gcc that was current at the time of release of the overlay files (2.18 and 3.4.6), and every single time I get stuck on an error that eventually boils down to:
Code: Select all/tmp/ccOHD9T1.s:19: Error: unknown opcode or format name 'entry'
/tmp/ccOHD9T1.s:29: Error: unknown opcode or format name 'retw.n'

In other words: the compiled cross-compiler spits out mnemonics the compiled cross-assembler in binutils can't make heads or tails of.

Anyway, you may want to tell Tensilica that they may want to use exactly this overlay file to solve our base problem; I think other overlays (eg the standard one that comes with gcc/binutils) don't have this problem.
User avatar
By jonsmirl
#181 Latest comment form Tensilica


I just tried that script and on my side it repacks overlay as expected.
But when I tried to build xtensa toolchain in buildroot it failed because
that core doesn't support windowed registers, which is expected by crt1.S
and other xtensa-specific assembly sources.
OTOH you don't need a compiler with linux libc anyway...
I'll look at the crosstool-ng.