Would CMD prompt/Terminal be possible on the Prizm?
Yes it would be possible to do it.
 100%  [ 10 ]
No it would not be possible.
 0%  [ 0 ]
Total Votes : 10

the C code would help...
flyingfisch wrote:
the C code would help...

seeing as the error is in the libprizmio.a
I think the terminal is pretty easy. Just some code about text console (like fxTerm does), simple 1 line editor (later extendable to remember command history, etc.). Some command parser with embedded command (like file operation, etc.).

I think the most interesting problem is how to call another program from shell. Assume one wants to run program "test" (addin named test.g3a) with parameters "p1 p2" and in some current directory (e.g. "\\fls0\testdata"). The shell will parse the addin name, find it and execute (there are syscalls for it).
But how to pass parameters, current directory and where to return ?
I think the shell may create some stack in some safe and well-known memory place (e.g. 0xE5200000 to 0xE5200FFF (4096 bytes) - IL memory).
It should have some magic, crc, etc.

The execution will be like following:
1. Shell fills and adds the call data on the top of the stack:
- the ID of the shell (number of the shell addin aka return address) + context data (if needed)
- parameters of the call
- current directory
- any other data we find useful
2. Shell calls test.g3a
3. test.g3a processes input parameters and removes it from the stack (only the ID of caller + it's context data will remain)
4. test.g3a starts main execution
5. test.g3a may call another addin (will take role of the shell in step 1)
6. test.g3a is about to end, it will run the previous addin (it's shell in this example). It may replace the caller ID by result code so shell will know if test.g3a passed.
7. shell is freshly starting but it will find it's context data so it will simulate it is continuing.

This way we can call an addin from different addin, but all addins must be compatible with this concept.

I never tried to implement it, but i think it's possible. Take it as a simple concept.
MPoupe wrote:
execute (there are syscalls for it)


Please, tell us more!
gbl08ma wrote:
MPoupe wrote:
execute (there are syscalls for it)


Please, tell us more!

Sorry, my memory is broken. I was thinking i have seen such syscall in fx_calculators_SuperH_based, but it is not here.

But following hack might work (just an idea):
1. enumerate *.g3a in the flash root directory.
2. assume they are in the same order as on main menu.
3. Find the needed addin.
4. ungetkey(MENU); ungetkey(<character corresponding to the addin>);
MPoupe wrote:
But following hack might work (just an idea):
1. enumerate *.g3a in the flash root directory.

No problems up to here, we definitely know how to do that.

MPoupe wrote:
2. assume they are in the same order as on main menu.

I have verified this is not always the situation. While there is some correlation between the order of files in flash (the order in which they are retrieved) and their order in the menu, this is not always true. You can verify this with the Add-In Manager tool in my Utilities add-in.

MPoupe wrote:
4. ungetkey(MENU); ungetkey(<character corresponding to the addin>);


Assuming that by "ungetkey" you mean the Prizm's equivalent of the fx9860 syscall PutKey, which puts a key in the keyboard buffer (emulating a key press), you have some problems there:

a) As far as I know, this syscall is yet to be found on the Prizm, even if there are some unconfirmed Bkey alternatives hinted in Simon's docs.

b) Since the keyboard buffer only has space for one key, your code would run to the PutKey(MENU) line, and stop there (code execution is paused when the Menu is opened).

b.1) Use timers? I'm sorry, user timers get stopped when the main menu is loaded.
b.1.1) Use a system timer? Good luck. You'd need to use the only free slot, 3 (assuming they didn't decide to use it with OS 2.00, and that in earlier versions it is never used) and make sure your timer handler is in memory for the duration of the time it is called - which means, the timer will have to uninstall itself right before calling the other add-in with PutKey (otherwise it will keep running but the handler will no longer be there -> system error), and yet manage to call the other add-in. Tip: do not use RS memory to store a timer handler (bricked a Prizm that way), as it is used by the OS for critical tasks. ILRAM might be OK but make sure the user doesn't have the opportunity to power off the calculator when the timer is running (ILRAM is cleared on standby).

c) After a certain number of add-ins, all the letters are used and no keyboard shortcuts are available to open them (but this would be a minor problem, if one managed to solve the above issues...).
Has nobody reverse-engineered the add-in launching process yet?
elfprince13 wrote:
Has nobody reverse-engineered the add-in launching process yet?


I haven't really looked into it, but I suspect it can only be safely done from the main process. Doing it from the child process where add-ins run is likely to cause problems because loading an add-in involves remapping the memory to the flash start of the add-in one wants to load, configuring the stack to contain the static RAM and finally jumping to the add-in code, among doing other things I don't know (maybe some things related to MCS, too, I really don't know). Doing this from inside another add-in would mean that at some point the code that was running gets remapped to the new add-in, meaning the code execution gets lost somewhere in between, when the memory is remapped to the new section of flash.
So any ideas on how to fix these problems.

Code:
F:/Programming/PrizmSDK-0.3/lib\libprizmio.a(console.o): In function `_nio_Scrol
lDown':
console.c:(.text+0x690): undefined reference to `_malloc'
console.c:(.text+0x694): undefined reference to `_memset'
console.c:(.text+0x69c): undefined reference to `_free'
F:/Programming/PrizmSDK-0.3/lib\libprizmio.a(console.o): In function `_nio_Clear
':
console.c:(.text+0x7f8): undefined reference to `_memset'
F:/Programming/PrizmSDK-0.3/lib\libprizmio.a(console.o): In function `_nio_InitC
onsole':
console.c:(.text+0x850): undefined reference to `_malloc'
F:/Programming/PrizmSDK-0.3/lib\libprizmio.a(console.o): In function `_nio_print
f':
console.c:(.text+0x9f4): undefined reference to `_memset'
console.c:(.text+0x9f8): undefined reference to `_vsprintf'
F:/Programming/PrizmSDK-0.3/lib\libprizmio.a(console.o): In function `_nio_Clean
Up':
console.c:(.text+0xb14): undefined reference to `_free'
collect2: ld returned 1 exit status


Any ideas on how to solve these errors.
It looks like you're not linking against libfxcg to me. You may want to double-check that you are in fact linking against it.
KermMartian wrote:
It looks like you're not linking against libfxcg to me. You may want to double-check that you are in fact linking against it.

what do you mean by linking against it? taking out the bit that calls libfxcg in the makefile?
Do you have -lfxcg in your Makefile somewhere in your gcc line? If not, add it, if so, what does your Makefile look like?
Here is my makefile:

Code:
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
# Set toolchain location in an environment var for future use, this will change
# to use a system environment var in the future.
#---------------------------------------------------------------------------------
ifeq ($(strip $(FXCGSDK)),)
export FXCGSDK := $(abspath ../../)
endif

include $(FXCGSDK)/common/prizm_rules


#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET      :=   $(notdir $(CURDIR))
BUILD      :=   build
SOURCES      :=   src
DATA      :=   data 
INCLUDES   :=

#---------------------------------------------------------------------------------
# options for code and add-in generation
#---------------------------------------------------------------------------------

MKG3AFLAGS := -n basic:CMDZM -i uns:../unselected.bmp -i sel:../selected.bmp

CFLAGS   = -std=c99 -Os -Wall $(MACHDEP) $(INCLUDE) -DPRIZM
CXXFLAGS   =   $(CFLAGS)

LDFLAGS   = $(MACHDEP) -T$(FXCGSDK)/common/prizm.ld -Wl,-static -Wl,-gc-sections -lprizmio

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS   :=   -lfxcg -lgcc

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS   :=

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT   :=   $(CURDIR)/$(TARGET)

export VPATH   :=   $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
               $(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR   :=   $(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES      :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES   :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES      :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES      :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES   :=   $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
   export LD   :=   $(CC)
else
   export LD   :=   $(CXX)
endif

export OFILES   :=   $(addsuffix .o,$(BINFILES)) \
               $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
               $(sFILES:.s=.o) $(SFILES:.S=.o)

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE   :=   $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
               $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
               -I$(CURDIR)/$(BUILD) -I$(LIBFXCG_INC)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS   :=   $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
               -L$(LIBFXCG_LIB)

export OUTPUT   :=   $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
   @[ -d $@ ] || mkdir $@
   @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
export CYGWIN := nodosfilewarning
clean:
   $(RM) -fr $(BUILD) $(OUTPUT).bin $(OUTPUT).g3a

#---------------------------------------------------------------------------------
else

DEPENDS   :=   $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).g3a: $(OUTPUT).bin
$(OUTPUT).bin: $(OFILES)


-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
Try adding -lfxcg after -lprizmio.
Still the same errors as before. Sad
krazylegodrummer56 wrote:
Still the same errors as before. Sad
Sorry, I didn't read closely. It looks like libprizmio (??) was not linked against libfxcg. Where are you building prizmio?
I put all the files from prizmio into the prizmSDK folder. Was it not supposed to join with the other files?
*Bump*

Any solutions?

krazylegodrummer56 wrote:
KermMartian wrote:
krazylegodrummer56 wrote:
Still the same errors as before. Sad
Sorry, I didn't read closely. It looks like libprizmio (??) was not linked against libfxcg. Where are you building prizmio?
I put all the files from prizmio into the prizmSDK folder. Was it not supposed to join with the other files?
*Double Bump*

Any solutions?

krazylegodrummer56 wrote:
KermMartian wrote:
krazylegodrummer56 wrote:
Still the same errors as before. Sad
Sorry, I didn't read closely. It looks like libprizmio (??) was not linked against libfxcg. Where are you building prizmio?
I put all the files from prizmio into the prizmSDK folder. Was it not supposed to join with the other files?
  
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 2 of 2
» 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