Hi all, so I am getting started with the Casio CG50 C programming, I followed the instructions from this thread https://www.cemetech.net/forum/viewtopic.php?t=14119 which has worked great, gcc built fine and works, the libfxcg was built fine and its samples also work, and if i make a change and rebuild and deploy to calc that all works.

A problem happened when I used sprintf and included stdio.h, whichever sample I try to use this it results in the following error:


Code:

sh3eb-elf-gcc  example.o -mb -m4a-nofpu -mhitachi -nostdlib -T/home/ab/casio/libfxcg/toolchain/prizm.x -Wl,-static -Wl,-gc-sections  -L/home/ab/casio/libfxcg/lib -lc -lfxcg -lgcc -o /home/ab/casio/libfxcg/examples/skeleton/skeleton.bin
/home/ab/casio-gcc/lib/gcc/sh3eb-elf/7.2.0/../../../../sh3eb-elf/bin/ld: BFD (GNU Binutils) 2.29.1 internal error, aborting at ../../binutils-2.29.1/bfd/linker.c:2162 in _bfd_generic_link_output_symbols

/home/ab/casio-gcc/lib/gcc/sh3eb-elf/7.2.0/../../../../sh3eb-elf/bin/ld: Please report this bug.

collect2: error: ld returned 1 exit status
make[1]: *** [/home/ab/casio/libfxcg/toolchain/prizm_rules:83: /home/ab/casio/libfxcg/examples/skeleton/skeleton.bin] Error 1
make: *** [Makefile:108: all] Error 2
 


if you are wondering what I changed in the code, the full "skeleton" sample code would look like this:


Code:

#include <fxcg/display.h>
#include <fxcg/keyboard.h>
#include <stdio.h>

void main(void) {
    int key;
     
    Bdisp_AllClr_VRAM();
    Print_OS("Press EXE to exit", 0, 0);

    char a[10];
    sprintf(a, "hi %d", 5);

    while (1) {
        GetKey(&key);

        if (key == KEY_CTRL_EXE) {
            break;
        }
    }
 
    return;
}



I am on Windows 10 using WSL 2, stuff mentioned above has been tested on both Debian 11 and Ubuntu 20, same behavior.

please guide as to what am i doing wrong here? thanks.
Can you try a newer GCC and binutils? I see you're using GCC 7.2.0 which is decently old and whatever issue you're hitting may have been fixed in a newer version.

Since you're on Windows you can skip building GCC yourself by simply using the PrizmSDK package or you could use the Docker image that libfxcg CI uses (that contains the tools).
I will try with the new binutils and compiler versions. I know about the downloadable sdk on windows but I want to stick to Linux because I am doing all this to get acquainted with Linux and learn new things.

Will also try the Docker image hope its being maintained well.
Tari wrote:
Can you try a newer GCC and binutils? I see you're using GCC 7.2.0 which is decently old and whatever issue you're hitting may have been fixed in a newer version.

Since you're on Windows you can skip building GCC yourself by simply using the PrizmSDK package or you could use the Docker image that libfxcg CI uses (that contains the tools).


so the problem seems to be solved, i used following gcc/binutils:
https://ftp.gnu.org/gnu/binutils/binutils-2.37.tar.xz
https://ftp.gnu.org/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.xz

built gcc/binutils, then built libfxcg from this new compiler, and using sprintf in the samples is building fine, i dont have the calculator (will check soon) right now but at least the build went fine Good Idea

Thanks.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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

 

Advertisement