setjmp.h for the Prizm?
15 posts
• Page 1 of 2 • 1, 2
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
setjmp.h for the Prizm?
Does anyone have a implementation, compatible with the Prizm, of the functions defined on setjmp.h? I'm trying to port a software that needs these functions.
I think the miniSDK has them but I need them in assembly so that I can compile them with GCC.
I think the miniSDK has them but I need them in assembly so that I can compile them with GCC.
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: setjmp.h for the Prizm?
gbl08ma wrote:Does anyone have a implementation, compatible with the Prizm, of the functions defined on setjmp.h? I'm trying to port a software that needs these functions.
I think the miniSDK has them but I need them in assembly so that I can compile them with GCC.
This is what I found, yet.
I do not know, if it is that what you are looking for.
(somesavespace has to located in static RAM.)
- Code: Select all
.SECTION P,CODE
longjmp:
mov.l #somesavespace, r0
mov.l r5, @r0
add #h'34, r4
mov.l @(h'18,r4), r0
ldc r0, gbr
mov.l @(h'14,r4), r0
lds r0, macl
mov.l @(h'10,r4), r0
lds r0, mach
mov.l @(8,r4), r1
mov.l @(4,r4), r2
mov.l @r4, r3
add #-h'34, r4
mov.l @(h'2C,r4), r5
mov.l @(h'28,r4), r6
mov.l @(h'24,r4), r7
mov.l @(h'20,r4), r8
mov.l @(h'1C,r4), r9
mov.l @(h'18,r4), r10
mov.l @(h'14,r4), r11
mov.l @(h'10,r4), r12
mov.l @(h'C,r4), r13
mov.l @(4,r4), r14
mov r4, r0
mov.l @(h'30,r0), r4
mov.l @r0, r15
mov.l @(8,r0), r0
lds r0, pr
mov.l #somesavespace, r0
mov.l @r0, r0
cmp/eq #0, r0
bf ?x
mov #1, r0
?x:
rts
nop
setjmp:
mov.l r15, @r4
mov.l r14, @(4,r4)
sts pr, r14
mov.l r14, @(8,r4)
mov.l @(4,r4), r14
mov.l r13, @(h'C,r4)
mov.l r12, @(h'10,r4)
mov.l r11, @(h'14,r4)
mov.l r10, @(h'18,r4)
mov.l r9, @(h'1C,r4)
mov.l r8, @(h'20,r4)
mov.l r7, @(h'24,r4)
mov.l r6, @(h'28,r4)
mov.l r5, @(h'2C,r4)
mov.l r4, @(h'30,r4)
add #h'30, r4
mov.l r3, @(4,r4)
mov.l r2, @(8,r4)
mov.l r1, @(h'C,r4)
mov.l r0, @(h'10,r4)
sts mach, r0
mov.l r0, @(h'14,r4)
sts macl, r0
mov.l r0, @(h'18,r4)
stc gbr, r0
mov.l r0, @(h'1C,r4)
mov.l @r4, r4
rts
mov #0, r0
.SECTION D,DATA
.align 4
somesavespace: .res.l 1
.end
I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: setjmp.h for the Prizm?
That may work, but since it is untested...
I found out that when LuaZM was written, Kerm at Cemetech wrote his own setjmp and longjmp implementation (because Lua needs it). Since that's probably already tested and more known to work, I'll be waiting some more hours for a reply there before I try to inline your assembly and use it.
EDIT: How big must somesavespace be?
I found out that when LuaZM was written, Kerm at Cemetech wrote his own setjmp and longjmp implementation (because Lua needs it). Since that's probably already tested and more known to work, I'll be waiting some more hours for a reply there before I try to inline your assembly and use it.
EDIT: How big must somesavespace be?
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: setjmp.h for the Prizm?
gbl08ma wrote:EDIT: How big must somesavespace be?
.res.l 1 == reserve one long
I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: setjmp.h for the Prizm?
Ah, OK. I still haven't managed to get any setjmp to work, but that's the smallest of my problems - I noticed that I'm also missing all the functions in math.h, because they are not implemented in libfxcg. The software really needs the math functions. I'll have to bother some more people to get them to work, before I get to the setjmp subject.
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: setjmp.h for the Prizm?
Are the object-modules in fx9860G_library.lib (which comes with the fx-9860-SDK) not compatible with GCC?
I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: setjmp.h for the Prizm?
I took a look before and I don't think so, they are only compatible with the proprietary SuperH compiler which only works on Windows. fxCG_library.lib seems to have the functions I need but I can't link them with my code. If I had the source code for it, I could try compiling the bits that interest to me with GCC, but as things are now, I can't do anything with it.
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: setjmp.h for the Prizm?
According to the SHC-manual, the objects-format is ELF. Doesn't your GCC support ELF?gbl08ma wrote:I took a look before and I don't think so, they are only compatible with the proprietary SuperH compiler which only works on Windows. fxCG_library.lib seems to have the functions I need but I can't link them with my code. If I had the source code for it, I could try compiling the bits that interest to me with GCC, but as things are now, I can't do anything with it.

I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: setjmp.h for the Prizm?
If I rename "fxCG_library.lib" to something that has the .a extension and starts with lib, i.e. "libfxcglibrary.a", then try to tell GCC to use it, when it starts linking it errors because it doesn't understand the library format:
This is understandable because your libs start with HLIB (seems to be something specific to the SH compiler) and the ones built with GCC start with the ascii chars !<arch> and then some things which seem to be identifiers, and the object code only comes next. So the libraries seem to be fully incompatible with GCC.
- Code: Select all
Casio-Pro/fixedSDK/common/prizm.ld -Wl,-static -Wl,-gc-sections -L/home/gabriel/Development/Casio-Pro/fixedSDK/lib -lfxcg -lc -lgcc -lnspireio -lfxcglibrary -o /home/gabriel/Development/Casio-Pro/fixedSDK/projects/eigenmath/eigenmath.bin
/home/gabriel/Development/Casio-Pro/fixedSDK/lib/libfxcglibrary.a: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make[1]: *** [/home/gabriel/Development/Casio-Pro/fixedSDK/projects/eigenmath/eigenmath.bin] Error 1
make: *** [build] Error 2
This is understandable because your libs start with HLIB (seems to be something specific to the SH compiler) and the ones built with GCC start with the ascii chars !<arch> and then some things which seem to be identifiers, and the object code only comes next. So the libraries seem to be fully incompatible with GCC.
- helder7
- Senior Member
- Posts: 369
- Joined: Tue Jan 03, 2012 11:24 pm
- Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400
Re: setjmp.h for the Prizm?
gbl08ma wrote:If I rename "fxCG_library.lib" to something that has the .a extension and starts with lib, i.e. "libfxcglibrary.a", then try to tell GCC to use it, when it starts linking it errors because it doesn't understand the library format.
i think that you need extract the .obj files from .lib and after convert them to .a to use in GCC
check this post: viewtopic.php?f=21&t=1472#p12770
SiO2 + CaCO3 ----------> CaSiO3 + CO2
15 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 5 guests