and I think that is stopping cog2. If that is true, then that would explain why I couldn't replicate the problem from C, because cog2 is the kernel and this is the one cog you can't stop before calling the driver because C needs to be running right up until the driver is called.
So this might now be a question for Ross if it is the kernel that is still controlling pin 8.
Yes, it looks like the Kernel is controlling pin 8. I don't have a schematic for the DRACBLADE handy, but here is what the XMM kernel thinks are the DRACBLADE control lines.
As you can see, I have pin 8 marked as "ram_MUX". Is this pin also used for the LCD? If so, you will need to tell the Kernel to release all the XMM control lines whenever it makes a service call - try compiling your program with -D SHARED_XMM - this will force the kernel to call XMM_Tristate before invoking any plugin (and XMM_Activate again afterwards).
I've never tried this on the DRACBLADE, but it should work.
Below is the code. I have been copying the LCD terminal code from Kyedos - this takes a 20x4 LCD and has a local buffer so it can scroll lines. Not everything is working but it is good enough to print "Hello World" and scroll it.
One thing this code really demonstrates is the ability to load and reload cogs many times. Because other programs might want to use the cogs too, this code uses the cogs only once and does not leave them running. Load the cog, load up and array with data and send out a string etc. Then use the cog for something else.
Loading cogs from an SD card is slow. But loading cogs from external memory is more than fast enough. It ends up being faster than a spin implementation, and in fact the limiting factor with the speed is the ability of the 20x4 LCD to keep up.
Thanks to all the help from Ross, it is now possible to put Catalina to sleep for a bit while the cog takes over all the pins.
There are also some differences compared with a spin implementation. eg, loading a cog up just to send one byte is inefficient, so it makes sense to load an entire string into an array and send that.
You can even use different cogs - eg send a string via cog 7, then scroll the LCD using cog 6.
Below is the code. Next little project - I need to think about a Gadget Gangster add-on board with external memory and the 20x4 LCD so that this can run on more boards than just the dracblade.
' This is a plugin for Catalina to pause catalina while talking to the LCD displayCON_clkfreq = 80_000_000' 5Mhz Crystal_clkmode = xtal1 + pll16x' x 16PUBMaincoginit(1,@entry,0) ' cog 1, cogstart, dummy valueDATorg0
entry
cogid t1 ' get ... t1=7shl t1,#2' ... our ... t1=28add t1,par' ... registry block par=7fd4, t1=7ff0rdlong rqstptr,t1 ' register ... rqstptr = 08007fccand rqstptr,low_24 ' ... this ... rqstptr = 00007fccrdlong arraypointer,rqstptr ' save for later as 7fcc gets changed below arraypointer = 6ab4wrlong zero,rqstptr ' ... plugin ... hub ram 7fcc = 0mov t2,#8' ... as ... t2=8 = dummy valueshl t2,#24' ... the ... t2=08000000or t2,rqstptr ' ... dummy ... t2=08007fccwrlong t2,t1 ' ... type hub ram 7ff0 = 08007fcc
service_loop
rdlong t1,rqstptr wz' service request? check 7fccif_zjmp #service_loop ' no - just keep waiting for catalina to allow this cog to run
processdata ' main program loopmov i,arraypointer ' i= a counter
main_loop rdlong t1,i ' get next long from arraycmp t1,minusone wz' is it the end?if_zjmp #release ' finish upmov t2,t1 ' new variable so preserves t1shr t2,#8' 0xnnnniidd where i is instruction, d is data to printand t2,lowmask ' get the instruction in t2mov data,t1
and data,lowmask ' data masked to low bytecmp t2,#0wz' 0 is print a characterif_zcall #lcd_text 'if 0 then send out a byte cmp t2,#1wz' 1 is a resetif_zcall #lcd_init 'if 1 then restart LCDcmp t2,#2wz' 2 is a commandif_zcall #lcd_inst ' send out an instruction eg move cursoradd i,#4' next longjmp #main_loop
release movdira,zero ' tristate all the pins wrlong zero,rqstptr ' release the kernel write zero to 7fcc
finish jmp #finish ' finish - endless loop' *********************************************************************************************'' Clock a 4 bit word in t1 to the LCD'
lcd_pulse_out
or t1, #%0000010' enable pin highcall #lcd_output
mov time,cnt' wait ...add time,lcd_delay ' ... for ...waitcnt time,#0' ... delayandn t1, #%0000010' enable pin lowcall #lcd_output
mov time,cnt' wait ...add time,lcd_delay ' ... for ...waitcnt time,#0' ... delay
lcd_pulse_out_ret
ret'**********************************************************************************************'' Output a value to the LCD'
lcd_output
movdira, latch_dir ' set latch direction, enable pins 0-11and t1, #$ffor t1, latch_lcd ' latch LCD with gate lowmovouta, t1
orouta, #%1_00000000' toggle gate highmovdira, zero ' tristate the outputs
lcd_output_ret
ret'**********************************************************************************************'' Initialize the LC display'
lcd_init
mov t1,zero ' set all pins low then pausecall #lcd_output
mov time,cnt' yes - wait ...add time,twohundredms ' ... for ...waitcnt time,#0' ... 200msmov t1, #%00001100' send out 0011 already shifted to xxnnnnxxcall #lcd_pulse_out
mov t1, #%00001100' send out 0011 already shifted to xxnnnnxxcall #lcd_pulse_out
mov t1, #%00001100' send out 0011 already shifted to xxnnnnxxcall #lcd_pulse_out
mov t1, #%00001000' send out 0010 already shifted to xxnnnnxxcall #lcd_pulse_out
mov t1, #%00001000' send out 0010 already shifted to xxnnnnxxcall #lcd_pulse_out
mov t1, #%00100000' send out 1000 already shifted to xxnnnnxxcall #lcd_pulse_out
mov data, #14' cursor onmov t1, data
shr t1, #2and t1, #%00111100call #lcd_pulse_out
mov t1, data
shl t1, #2and t1, #%00111100call #lcd_pulse_out
mov data, #1' clear screenmov t1, data
shr t1, #2and t1, #%00111100call #lcd_pulse_out
mov t1, data
shl t1, #2and t1, #%00111100call #lcd_pulse_out
mov data, #13' flashing cursormov t1, data
shr t1, #2and t1, #%00111100call #lcd_pulse_out
mov t1, data
shl t1, #2and t1, #%00111100call #lcd_pulse_out
mov data, #$80' to position 1mov t1, data
shr t1, #2and t1, #%00111100call #lcd_pulse_out
mov t1, data
shl t1, #2and t1, #%00111100call #lcd_pulse_out
lcd_init_ret
ret'**********************************************************************************************'' Send an LCD instruction'
lcd_inst
mov t1, data
shr t1, #2and t1, #%00111100call #lcd_pulse_out
mov t1, data
shl t1, #2and t1, #%00111100call #lcd_pulse_out
lcd_inst_ret
ret'**********************************************************************************************'' Send an LCD text character'
lcd_text
mov t1, data
shr t1, #2and t1, #%00111100or t1, #1call #lcd_pulse_out
mov t1, data
shl t1, #2and t1, #%00111100or t1, #1call #lcd_pulse_out
lcd_text_ret
ret'*********************************************************************************************' *************** variables ******************************************************************
low_24 long$00FFFFFF
two_seconds long_clkfreq*2
twohundredms long_clkfreq/5
time long0
rqstptr long0
i long0
t1 long0
t2 long0
zero long0
data long0
minusone long$FFFFFFFF'sixabfour long $6AB4'sevenfcc long $7FCC
arraypointer long0
debug long$1000' for debugging
testvalue long$12345678
lowmask long%00000000_00000000_00000000_11111111' *** LCD variables ***
latch_dir long%00000000_00000000_00001111_11111111' 138 active, gate active and 8 data lines active
latch_lcd long%00000000_00000000_00001010_00000000' LCD latch is xxxx101x and gate low xxxxxxx0
enable_lcd long%00000000_00000000_00000000_00000010' Enable pin 6 on LCD displays
lcd_delay long20_000' 300_000 = safe, 5000 doesnt 10_000 works, make it 20_000{{
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? TERMS OF USE: MIT License ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation ?
?files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, ?
?modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software?
?is furnished to do so, subject to the following conditions: ?
? ?
?The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.?
? ?
?THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE ?
?WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ?
?COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ?
?ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
}}
#include<stdio.h>#include<string.h>// compile with catalina -lcx -D PLUGIN -lm -x5 -M 256k -d DRACBLADE -D SHARED_XMM -D HIRES_VGA myprog.c// compile using XMM// pairs with LCDPLUG.spin// cogjects - sd card driver in catalina is a little slow so load up once into external ram then (re) load quicker from external ramunsignedlong cogject_plugin[512]; // external memory for pluginchar lcddisplay[90]; // buffer for LCD display 80 chars plus the column,row data, in external ramchar lineoftext[80]; // for storing strings// *************** functions ***************************************voidsleep(int milliseconds)// sleep function{
_waitcnt(_cnt()+(milliseconds*(_clockfreq()/1000))-4296);
}
charpeek(int address)// function implementation of peek{
return *((char *)address);
}
voidpoke(int address, char value)// function implementation of poke{
*((char *)address) = value;
}
voidpokelong(int address, unsignedlong value)// poke a long into hub memory 'little endian'{
poke(address+0, (char) (value & 0x000000ff));
poke(address+1, (char) ((value & 0x0000ff00) >> 8));
poke(address+2, (char) ((value & 0x00ff0000) >> 16));
poke(address+3, (char) ((value & 0xff000000) >> 24));
}
unsignedlongpeeklong(int address)// peek a long from hub memory 'little endian'{
unsignedlong value;
value = peek(address) | (peek(address+1) <<8) | (peek(address+2) <<16) | (peek(address+3)<<24);
return value;
}
intexternal_plugin_cog_load(int cognumber, unsignedlong cogdata[])// load a plugin from external memory{
unsignedlong hubcog[512]; // create a local array, this is in hub ram, not external ramint i;
int result;
for(i=0;i<512;i++)
{
hubcog[i]=cogdata[i]; // move from external memory to a local array in hub
}
_coginit (_registry() >> 2, (int) hubcog >> 2, cognumber); // pass the registry, location of cog data and cog to load intoreturn result;
}
intEoF(FILE* stream){
registerint c, status = ((c = fgetc(stream)) == EOF);
ungetc(c,stream);
return status;
}
voidreadcog(char *filename,unsignedlong external_cog[])// read in a .cog file into external memory array{
int i;
FILE *FP1;
i = 0;
if((FP1=fopen(filename,"rb"))==0) // open the file
{
fprintf(stderr,"Can't open file %s\n",filename);
exit(1);
}
fseek(FP1,0,0);
for(i=0;i<24;i++)
{
getc(FP1); // read in the first 24 bytes and discard
}
i = 0;
while(!EoF(FP1) & (i<511)) // run until end of file or 511-6
{
external_cog[i] = getc(FP1) | (getc(FP1)<<8) | (getc(FP1)<<16) | (getc(FP1)<<24); // get the long
i+=1;
}
if(FP1)
{
fclose(FP1); // close the file
FP1=NULL;
}
//printf("external array cog first long = 0x%x \n",external_cog[0]); // hex value
}
/*
void print7fcc()
{
int i;
char peekbyte;
printf("4 bytes from 7fcc to 7fc3 are ");
for (i=0;i<4;i++)
{
peekbyte = peek(0x7fcc+i);
if (peekbyte < 16)
{
printf("0");
}
printf("%x ",peekbyte);
}
printf ("\n"); // carriage return
}
void print_registry() // 32 bytes
{
int reg;
int i;
char peekbyte;
reg = _registry();
printf("0x%x = ",reg);
for (i=0;i<32;i++)
{
peekbyte = peek(reg+i);
if (peekbyte < 16)
{
printf("0");
}
printf("%x",peekbyte);
}
printf ("\n"); // carriage return
}
*/voidpass_plugin_data(unsignedlong p_array[],int cognumber){
int reg;
int a;
unsignedlong b,c;
// print_registry();
reg = _registry();
a=reg + (cognumber << 2); // registry + cognumber *4
b=peeklong(a); // get the registry for this cog ff007fcc
b = b & 0x0000ffff; // mask off upper two bytes
c = (unsignedlong) &p_array[0]; // pointer to p_array// printf("pointer value is %x \n",c);
pokelong(b,c); // address,value 7fcc now contains a pointer to the p_array[0]// print7fcc();
}
voidinit_lcd(int cognumber){
unsignedlong lcd_array[10]; // temporary array for sending a string of data to the LCDint i;
lcd_array[0] = 0x00000100; // command to initialise nnnn01nn
lcd_array[1] = 0x0000020e; // cursor on
lcd_array[2] = 0x00000201; // cls
lcd_array[3] = 0x0000020d; // flashing cursor
lcd_array[4] = 0x00000280; // top left hand corner
lcd_array[5] = 0xffffffff; // finish command = -1
pass_plugin_data(lcd_array,cognumber); // tell the plugin where the data is
external_plugin_cog_load(cognumber, cogject_plugin); // move plugin from external memory to cog 7
_sys_plugin(8, 1); // 8 is dummy plugin, and 1 is any non zero numberfor(i=0;i<80;i++)
{
lcddisplay[i]=32; // clear the buffer to spaces(common hub array)
}
lcddisplay[80]=0; // column 0-19
lcddisplay[81]=1; // line number 1,2,3 or 4
}
voidredraw(int cognumber)// redraw the entire screen{
int linenumber;
int n,m,i,j,c;
unsignedlong lcd_array[90]; // enough room to pass all 80 characters and start and finish
linenumber = (int) lcddisplay[81]; // get the linenumber in a local variable
n = (linenumber - 1) * 20; // convert to a pointer to the correct array location
lcd_array[0] = 0x00000280; // instruction (02) and value (0x80 = 128 = line 1)
lcd_array[21] = 0x000002c0; // instruction (02) and value (0xC0 = 192 = line 2)
lcd_array[42] = 0x00000294; // instruction (02) and value (0x94 = 148 = line 3)
lcd_array[63] = 0x000002d4; // instruction (02) and value (0xD4 = 212 = line 4)
lcd_array[84] = 0x000002d4; // instruction (02) and value (0xD4 = 212 = line 4) at end
lcd_array[85] = 0x0000020d; // flashing cursor
lcd_array[86] = 0xffffffff; // finish command
n=1;
m=0;
for(i=0;i<20;i++)
{
lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time
m++;
n++;
}
n=22;
m=20;
for(i=0;i<20;i++)
{
lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time
m++;
n++;
}
n=43;
m=40;
for(i=0;i<20;i++)
{
lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time
m++;
n++;
}
n=64;
m=60;
for(i=0;i<20;i++)
{
lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time
m++;
n++;
}
// load cog, send out all data, hand control back to catalina
pass_plugin_data(lcd_array,cognumber); // tell the plugin where the data is
external_plugin_cog_load(cognumber, cogject_plugin); // move plugin from external memory to hub ram
_sys_plugin(8, 1); // and start it 8 is dummy plugin, and 1 is any non zero number
}
voidnewline(int cognumber)// move the line up by 1, clear line 4, move cursor to start of line 4{
int i;
for(i=0;i<60;i++)
{
lcddisplay[i] = lcddisplay[i+20]; // shuffle up a line
}
for(i=60;i<80;i++)
{
lcddisplay[i] = 32; // spaces on the last line
}
lcddisplay[80]=0; // column = 0
redraw(cognumber);
}
voidprintf_lcd(int cognumber, char textstring[])// note that this loads and unloads a cog to print just one char so do in a group if print a string{
int col,i,length,p,overflow;
unsignedlong lcd_array[20]; // enough room to pass characters
col = (int) lcddisplay[80]; // get the column number
length = strlen(textstring);
// printf("length is %i \n",length);
overflow = col+length-20; // off the end?if (overflow <0) overflow = 0;
for(i=0;i < length -overflow;i++)
{
lcddisplay[60 + col + i] = textstring[i]; // store in the screen buffer// printf("value of i is %i \n",i);
}
for(i=0;i < length - overflow;i++)
{
lcd_array[i] = textstring[i]; // print out
}
p = length;
// pointer to where we are up to// printf("length is %i \n",p);if (col+length >19)
{
lcd_array[p] = 0x0000020c; // cursor off if last char on the line// printf("cursor off \n");
p++;
}
lcd_array[p] = 0xffffffff; // terminate command
col = col + length;
// printf("column is %i \n",col);
lcddisplay[80] = (char) col; // put the column number back in the array
pass_plugin_data(lcd_array,cognumber); // tell the plugin where the data is
external_plugin_cog_load(cognumber, cogject_plugin); // move plugin from external memory to hub ram
_sys_plugin(8, 1); // and start it 8 is dummy plugin, and 1 is any non zero number
}
//void backspace(int cognumber)//{// backspace is a special case - need to subtract 1 off the column, make the last character a space// and redraw the screen and print out column number of characters on last line// only really works on line 4 but most of the time the display is on line 4 anyway// not working as yet// int col,i;// char tempstring[20];// col = (int) lcddisplay[80]; // get the column number// if ((col>1) & (col<20))// {// lcddisplay[col + 60] = 32; // was 1 past the character// col--;// }// lcddisplay[80] = (char) col; // put the column number back in the array// redraw(cognumber); // cursor to beginning of the last line// for(i=0;i<(col-2);i++)// {// tempstring[i]=lcddisplay[60+i]; // print out characters on the last line so cursor in the right place// }// tempstring[col-2] = 0; // terminator// printf("temp string is ",tempstring);// printf_lcd(cognumber,tempstring);//}voidmain(){
printf("Test program to use the LCD on the dracblade with XMM catalina\n");
readcog("lcdplug.cog",cogject_plugin); // read from sd card into an external memory array
init_lcd(7); // clear the screen, turn on the cursor
redraw(7); // redraw the lcd, using driver in cog 7
newline(7); // scroll up a linestrcpy(lineoftext, "Hello ");
printf_lcd(7,lineoftext); // print string (reloads cog)strcpy(lineoftext, "World");
printf_lcd(7,lineoftext); // print string (reloads cog)
newline(7); // scroll
sleep(2000);
redraw(7); // check same as on the displayprintf("Finish \n");
// printf("debug value @ 0x1000 = 0x%x \n",peeklong(0x1000)); // useful debug locationwhile (1); // Prop reboots on exit from main()
}
Hi everybody,
I just started to use Catalina 3.0 with ther latest patch.
But unfortunetly I can't make it compile
I followed the guide provided with the compiler.
Hi everybody,
I just started to use Catalina 3.0 with ther latest patch.
But unfortunetly I can't make it compile
I followed the guide provided with the compiler.
I've finally given in and purchased a copy of Windows 7, so I will be able to support this platform better in future - but I only installed it today, so bear with me while I'm still learning
First, can you please check to see if the file C:\Program Files\Catalina\target\lmm_default.spin actually exists? If not, you have something wrong with your target directory, and you should re-install Catalina.
If it does exist, then the problem may be to do with where you have installed Catalina. On my new Windows 7 machine, I seem to have some some issues when Catalina is installed in the recommended directory (i.e. C:\Program Files\Catalina or C:\Program Files (X86)\Catalina).
However, I just moved the whole directory to C:\Catalina, and everything now seems to work correctly. To see if this helps you, move your entire Catalina directory from C:\Program Files\Catalina to C:\Catalina, then start a new command shell and enter the following commands:
cd C:\Catalina
set LCCDIR=C:\Catalina
use_catalina
cd demos
catalina -lc hello_world.c
Have you modified the Catalina installation in any way? Could you re-install a clean copy of Catalina from the original zip into a new directory (e.g. unzip it to to C:\Catalina2) and then open a command prompt and execute the following:
cd C:\Catalina2
set LCCDIR=C:\Catalina2
use_catalina
cd demos
catalina -lc hello_world.c
This works for me first time.
I'll be out of contact for about an hour - I'll check back in then.
I downloaded again from sourceforge
unziped and install in the c:\ dairectory as catalina2
and did what you say and teh result is
[code]Microsoft Windows [S
I can confirm that there is some really odd behaviour under Windows 7. I have not yet managed to track it down, but it seems that occasionally the file lmm_default.spin is being corrupted. I will investigate further tomorrow. In the meantime, can you please post the current contents of your lmm_default.spin file?
I've seen some wierd things in the last day or so under Windows 7, but never under XP.
I plan to investigate this today, so bear with me. Can you please post the lmm_default.spin file from your target directory? That may give me a clue. I managed to corrupt mine once, but before I realized what was going on, I overwrote it with a new copy.
UPDATE: A modified version of the catalina_env.bat file is attached to the first post in this thread. While it can be used on any Windows platform, it is specifically intended for Windows 7 and Vista users, to fix a problem when using the catalina_env command on those platforms. Just download the catalina_env.zip file and unzip it over the existing version in your Catalina bin directory.
There is another minor oddity which I just noticed with Windows 7 - when you set LCCDIR (which you need to do if you installed Catalina in a non-standard directory), you have to make sure you don't include any quotation marks - e.g. you must say:
set LCCDIR=C:\Program Files (x86)\Catalina
and not
set LCCDIR="C:\Program Files (x86)\Catalina" <--- WRONG!
I think the latter works under XP - but it doesn't work under Windows 7.
I've been trying since yesterday to reproduce the strange behaviour drRobutik has reported seeing under Windows 7. Apart from one problem with the catalina_env batch file (see previous post), I can't make Catalina behave the way drRobutik is reporting. I've reinstalled it several times to different locations, and tried compiling many programs - and they all seem to compile and run correctly.
Has anyone else seen any weird problems using Catalina under Windows 7?
I did see one instance of odd behaviour yesterday, but I have been unable to reproduce it, and I now think it may have been because I was still in the middle of installing all the zillions of Windows 7 patches (how can there be so many already???). Anyway, I now seem to have them all installed, and everything seems to be working reliably.
I think I have found a clue to the bizarre behaviour of Windows 7. I think you may be running into problems with the Windows 7 VirtualStore feature. This web site shows how to disable VirtualStore for a particular application: http://www.twcenter.net/forums/showthread.php?t=397636
I chose to use solution 3 - essentially, you give users "full control" and "modify" rights to the Catalina directory, and then delete the contents of any existing Catalina VirtualStore folders.
Hi Ross
Tried everything you have given,
but still Win7 insist to not compile
still same problem..
Hi drRobutik,
This is a bit of a mystery. You haven't yet posted your lmm_default.spin file from your target directory. Can you do that please? This may give me a clue.
Then try the following (please substitute your installation directory for C:\Program Files\Catalina in the following commands):
1. Check whether Homespun can compile simple Spin files. There is one in the Catalyst demo folder:
cd C:\Program Files\Catalina
set LCCDIR=C:\Program Files\Catalina
use_catalina
cd catalyst\demo
homespun demo.spin
2. Check whether it is only the lmm_default.spin file that is affected:
cd C:\Program Files\Catalina
set LCCDIR=C:\Program Files\Catalina
use_catalina
cd demos
catalina -lc -D LARGE hello_world.c
3. Check whether Homespun can find lmm_default.spin when it is in the same directory:
cd C:\Program Files\Catalina
set LCCDIR=C:\Program Files\Catalina
use_catalina
cd target
homespun lmm_default.spin -D TINY
1. Check whether Homespun can compile simple Spin files. There is one in the Catalyst demo folder:
2. Check whether it is only the lmm_default.spin file that is affected:
3. Check whether Homespun can find lmm_default.spin when it is in the same directory:
FWIW, I'm using Vista (JPN) with a non-admin account. Check one and three work without problems, the second one effectively leaves me with an empty target/Catalina.spin file (zero length). Which subsequently makes homespun complain about missing PUB methods.
FWIW, I'm using Vista (JPN) with a non-admin account. Check one and three work without problems, the second one effectively leaves me with an empty target/Catalina.spin file (zero length).
Thanks for doing that. The problem you are seeing with step 2 is a different problem. I think this is because the account you are using does not have write permission to the Catalina target directory.
The steps I described earlier to remove the VirtualStore functionality on Catalina also gives all users "modify" access to the Catalina directory, so this should fix that.
If that does not fix it, then it may also be because Catalina does not have write access to the directory where it expects to create temporary files. You can set this directory two ways:
1. By adding -W-tempdir=<temp dir> to each compile command. For example:
catalina -lc hello_world.c -W-tempdir=.
2. By doing a "one off" setup it in your CATALINA_TEMPDIR environment variable. For example:
the catalina directory is in a public area. So write access isn't an issue. Even specifically setting the rights for the directory (full control) doesn't change anything. Neither does specifying a different temporary directory (env or command line). If it bothers you could you send me a debug version which displays the path to the temporary file(s) it cannot open?
Update: I must admit that I didn't install Catalina under C:/Program Files/Catalina (none of my 3rd party stuff is). So if one or more of the environment defaults rely on that location then this could be an issue. What are the exact locations to override the defaults?
Just read in the manual that setting LCCDIR to a different location should have taken care of that ... most odd. Anyway, homespun itself didn't and still doesn't have problems creating files in that (public) hierarchy so why should catalina?
the catalina directory is in a public area. So write access isn't an issue. Even specifically setting the rights for the directory (full control) doesn't change anything. Neither does specifying a different temporary directory (env or command line). If it bothers you could you send me a debug version which displays the path to the temporary file(s) it cannot open?
Update: I must admit that I didn't install Catalina under C:/Program Files/Catalina (none of my 3rd party stuff is). So if one or more of the environment defaults rely on that location then this could be an issue. What are the exact locations to override the defaults?
Just read in the manual that setting LCCDIR to a different location should have taken care of that ...
Yes, just set LCCDIR. If you still can't get it working, let me know. I'm still learning all the tricks and traps with Windows, so any feedback on problems/fixes is very useful.
Blast! - that version doesn't print the names of the tmp files themselves. Can you unzip the attached version of catbind.exe into your Catalina bin directory and try that command again?
Comments
Thanks for your help!
Hi Dr_A,
Yes, it looks like the Kernel is controlling pin 8. I don't have a schematic for the DRACBLADE handy, but here is what the XMM kernel thinks are the DRACBLADE control lines.
' DracBlade Hardware Access: ' ' (P24) M_PORT2-------------+ +-------- VGA (P23) ' (P25) M_PORT2------------+| |+------- VGA (P22) ' (P26) KB ---------------+|| ||+------ VGA (P21) ' (P27) KB --------------+||| |||+----- VGA (P20) ' (P28) SCL ------------+|||| ||||+---- VGA (P19) ' (P29) SDA -----------+||||| |||||+--- VGA (P18) ' (P30) SO -----------+|||||| ||||||+-- VGA (P17) ' (P31) SI ----------+||||||| |||||||+- VGA (P16) ' |||||||| |||||||| ram_MUX long %00000000_00000000_0000_0001_00000000 ' active low ram_WR long %00000000_00000000_0000_0011_00000000 ram_A0_A7 long %00000000_00000000_0000_0101_00000000 ram_A8_A15 long %00000000_00000000_0000_0111_00000000 ram_A16_A19 long %00000000_00000000_0000_1001_00000000 ram_dir_read long %00000000_00000000_0000_1111_00000000 ram_dir_write long %00000000_00000000_0000_1111_11111111 ' |||| |||| |||||||| ' SD CS ---(P15)-+||| |||| |-DATA-| ' SD DI ---(P14)--+|| |||| 76543210 ' SD CLK --(P13)---+| |||| ' SD DO ---(P12)----+ |||+--(P8) ---- /mux (active low) ' ||+---(P9)---+ ' |+---(P10)--+| ' +----(P11)-+|| ' ||| ' ||| ' 000 /RD_RAM ' 001 /WR_RAM ' 010 /CS_A0-A7 ' 011 /CS_A8-A15 ' 100 /CS_A16-A18 ' 101 /CS_LCD ' 110 Not connected ' 111 Not connected
As you can see, I have pin 8 marked as "ram_MUX". Is this pin also used for the LCD? If so, you will need to tell the Kernel to release all the XMM control lines whenever it makes a service call - try compiling your program with -D SHARED_XMM - this will force the kernel to call XMM_Tristate before invoking any plugin (and XMM_Activate again afterwards).I've never tried this on the DRACBLADE, but it should work.
Ross.
And there you go. That has fixed it!!!! Woot, and much rejoicing
We can now take over the bottom 12 pins from a plugin, and do all sorts of things with those 12 pins.
Congratulations!
One thing this code really demonstrates is the ability to load and reload cogs many times. Because other programs might want to use the cogs too, this code uses the cogs only once and does not leave them running. Load the cog, load up and array with data and send out a string etc. Then use the cog for something else.
Loading cogs from an SD card is slow. But loading cogs from external memory is more than fast enough. It ends up being faster than a spin implementation, and in fact the limiting factor with the speed is the ability of the 20x4 LCD to keep up.
Thanks to all the help from Ross, it is now possible to put Catalina to sleep for a bit while the cog takes over all the pins.
There are also some differences compared with a spin implementation. eg, loading a cog up just to send one byte is inefficient, so it makes sense to load an entire string into an array and send that.
You can even use different cogs - eg send a string via cog 7, then scroll the LCD using cog 6.
Below is the code. Next little project - I need to think about a Gadget Gangster add-on board with external memory and the 20x4 LCD so that this can run on more boards than just the dracblade.
' This is a plugin for Catalina to pause catalina while talking to the LCD display CON _clkfreq = 80_000_000 ' 5Mhz Crystal _clkmode = xtal1 + pll16x ' x 16 PUB Main coginit(1,@entry,0) ' cog 1, cogstart, dummy value DAT org 0 entry cogid t1 ' get ... t1=7 shl t1,#2 ' ... our ... t1=28 add t1,par ' ... registry block par=7fd4, t1=7ff0 rdlong rqstptr,t1 ' register ... rqstptr = 08007fcc and rqstptr,low_24 ' ... this ... rqstptr = 00007fcc rdlong arraypointer,rqstptr ' save for later as 7fcc gets changed below arraypointer = 6ab4 wrlong zero,rqstptr ' ... plugin ... hub ram 7fcc = 0 mov t2,#8 ' ... as ... t2=8 = dummy value shl t2,#24 ' ... the ... t2=08000000 or t2,rqstptr ' ... dummy ... t2=08007fcc wrlong t2,t1 ' ... type hub ram 7ff0 = 08007fcc service_loop rdlong t1,rqstptr wz ' service request? check 7fcc if_z jmp #service_loop ' no - just keep waiting for catalina to allow this cog to run processdata ' main program loop mov i,arraypointer ' i= a counter main_loop rdlong t1,i ' get next long from array cmp t1,minusone wz ' is it the end? if_z jmp #release ' finish up mov t2,t1 ' new variable so preserves t1 shr t2,#8 ' 0xnnnniidd where i is instruction, d is data to print and t2,lowmask ' get the instruction in t2 mov data,t1 and data,lowmask ' data masked to low byte cmp t2,#0 wz ' 0 is print a character if_z call #lcd_text 'if 0 then send out a byte cmp t2,#1 wz ' 1 is a reset if_z call #lcd_init 'if 1 then restart LCD cmp t2,#2 wz ' 2 is a command if_z call #lcd_inst ' send out an instruction eg move cursor add i,#4 ' next long jmp #main_loop release mov dira,zero ' tristate all the pins wrlong zero,rqstptr ' release the kernel write zero to 7fcc finish jmp #finish ' finish - endless loop ' ********************************************************************************************* ' ' Clock a 4 bit word in t1 to the LCD ' lcd_pulse_out or t1, #%0000010 ' enable pin high call #lcd_output mov time,cnt ' wait ... add time,lcd_delay ' ... for ... waitcnt time,#0 ' ... delay andn t1, #%0000010 ' enable pin low call #lcd_output mov time,cnt ' wait ... add time,lcd_delay ' ... for ... waitcnt time,#0 ' ... delay lcd_pulse_out_ret ret '********************************************************************************************** ' ' Output a value to the LCD ' lcd_output mov dira, latch_dir ' set latch direction, enable pins 0-11 and t1, #$ff or t1, latch_lcd ' latch LCD with gate low mov outa, t1 or outa, #%1_00000000 ' toggle gate high mov dira, zero ' tristate the outputs lcd_output_ret ret '********************************************************************************************** ' ' Initialize the LC display ' lcd_init mov t1,zero ' set all pins low then pause call #lcd_output mov time,cnt ' yes - wait ... add time,twohundredms ' ... for ... waitcnt time,#0 ' ... 200ms mov t1, #%00001100 ' send out 0011 already shifted to xxnnnnxx call #lcd_pulse_out mov t1, #%00001100 ' send out 0011 already shifted to xxnnnnxx call #lcd_pulse_out mov t1, #%00001100 ' send out 0011 already shifted to xxnnnnxx call #lcd_pulse_out mov t1, #%00001000 ' send out 0010 already shifted to xxnnnnxx call #lcd_pulse_out mov t1, #%00001000 ' send out 0010 already shifted to xxnnnnxx call #lcd_pulse_out mov t1, #%00100000 ' send out 1000 already shifted to xxnnnnxx call #lcd_pulse_out mov data, #14 ' cursor on mov t1, data shr t1, #2 and t1, #%00111100 call #lcd_pulse_out mov t1, data shl t1, #2 and t1, #%00111100 call #lcd_pulse_out mov data, #1 ' clear screen mov t1, data shr t1, #2 and t1, #%00111100 call #lcd_pulse_out mov t1, data shl t1, #2 and t1, #%00111100 call #lcd_pulse_out mov data, #13 ' flashing cursor mov t1, data shr t1, #2 and t1, #%00111100 call #lcd_pulse_out mov t1, data shl t1, #2 and t1, #%00111100 call #lcd_pulse_out mov data, #$80 ' to position 1 mov t1, data shr t1, #2 and t1, #%00111100 call #lcd_pulse_out mov t1, data shl t1, #2 and t1, #%00111100 call #lcd_pulse_out lcd_init_ret ret '********************************************************************************************** ' ' Send an LCD instruction ' lcd_inst mov t1, data shr t1, #2 and t1, #%00111100 call #lcd_pulse_out mov t1, data shl t1, #2 and t1, #%00111100 call #lcd_pulse_out lcd_inst_ret ret '********************************************************************************************** ' ' Send an LCD text character ' lcd_text mov t1, data shr t1, #2 and t1, #%00111100 or t1, #1 call #lcd_pulse_out mov t1, data shl t1, #2 and t1, #%00111100 or t1, #1 call #lcd_pulse_out lcd_text_ret ret '********************************************************************************************* ' *************** variables ****************************************************************** low_24 long $00FFFFFF two_seconds long _clkfreq*2 twohundredms long _clkfreq/5 time long 0 rqstptr long 0 i long 0 t1 long 0 t2 long 0 zero long 0 data long 0 minusone long $FFFFFFFF 'sixabfour long $6AB4 'sevenfcc long $7FCC arraypointer long 0 debug long $1000 ' for debugging testvalue long $12345678 lowmask long %00000000_00000000_00000000_11111111 ' *** LCD variables *** latch_dir long %00000000_00000000_00001111_11111111 ' 138 active, gate active and 8 data lines active latch_lcd long %00000000_00000000_00001010_00000000 ' LCD latch is xxxx101x and gate low xxxxxxx0 enable_lcd long %00000000_00000000_00000000_00000010 ' Enable pin 6 on LCD displays lcd_delay long 20_000 ' 300_000 = safe, 5000 doesnt 10_000 works, make it 20_000 {{ ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ? TERMS OF USE: MIT License ? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation ? ?files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, ? ?modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software? ?is furnished to do so, subject to the following conditions: ? ? ? ?The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.? ? ? ?THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE ? ?WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ? ?COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ? ?ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? }}
#include <stdio.h> #include <string.h> // compile with catalina -lcx -D PLUGIN -lm -x5 -M 256k -d DRACBLADE -D SHARED_XMM -D HIRES_VGA myprog.c // compile using XMM // pairs with LCDPLUG.spin // cogjects - sd card driver in catalina is a little slow so load up once into external ram then (re) load quicker from external ram unsigned long cogject_plugin[512]; // external memory for plugin char lcddisplay[90]; // buffer for LCD display 80 chars plus the column,row data, in external ram char lineoftext[80]; // for storing strings // *************** functions *************************************** void sleep(int milliseconds) // sleep function { _waitcnt(_cnt()+(milliseconds*(_clockfreq()/1000))-4296); } char peek(int address) // function implementation of peek { return *((char *)address); } void poke(int address, char value) // function implementation of poke { *((char *)address) = value; } void pokelong(int address, unsigned long value) // poke a long into hub memory 'little endian' { poke(address+0, (char) (value & 0x000000ff)); poke(address+1, (char) ((value & 0x0000ff00) >> 8)); poke(address+2, (char) ((value & 0x00ff0000) >> 16)); poke(address+3, (char) ((value & 0xff000000) >> 24)); } unsigned long peeklong(int address) // peek a long from hub memory 'little endian' { unsigned long value; value = peek(address) | (peek(address+1) <<8) | (peek(address+2) <<16) | (peek(address+3)<<24); return value; } int external_plugin_cog_load(int cognumber, unsigned long cogdata[]) // load a plugin from external memory { unsigned long hubcog[512]; // create a local array, this is in hub ram, not external ram int i; int result; for(i=0;i<512;i++) { hubcog[i]=cogdata[i]; // move from external memory to a local array in hub } _coginit (_registry() >> 2, (int) hubcog >> 2, cognumber); // pass the registry, location of cog data and cog to load into return result; } int EoF (FILE* stream) { register int c, status = ((c = fgetc(stream)) == EOF); ungetc(c,stream); return status; } void readcog(char *filename,unsigned long external_cog[]) // read in a .cog file into external memory array { int i; FILE *FP1; i = 0; if((FP1=fopen(filename,"rb"))==0) // open the file { fprintf(stderr,"Can't open file %s\n",filename); exit(1); } fseek(FP1,0,0); for(i=0;i<24;i++) { getc(FP1); // read in the first 24 bytes and discard } i = 0; while(!EoF(FP1) & (i<511)) // run until end of file or 511-6 { external_cog[i] = getc(FP1) | (getc(FP1)<<8) | (getc(FP1)<<16) | (getc(FP1)<<24); // get the long i+=1; } if(FP1) { fclose(FP1); // close the file FP1=NULL; } //printf("external array cog first long = 0x%x \n",external_cog[0]); // hex value } /* void print7fcc() { int i; char peekbyte; printf("4 bytes from 7fcc to 7fc3 are "); for (i=0;i<4;i++) { peekbyte = peek(0x7fcc+i); if (peekbyte < 16) { printf("0"); } printf("%x ",peekbyte); } printf ("\n"); // carriage return } void print_registry() // 32 bytes { int reg; int i; char peekbyte; reg = _registry(); printf("0x%x = ",reg); for (i=0;i<32;i++) { peekbyte = peek(reg+i); if (peekbyte < 16) { printf("0"); } printf("%x",peekbyte); } printf ("\n"); // carriage return } */ void pass_plugin_data(unsigned long p_array[],int cognumber) { int reg; int a; unsigned long b,c; // print_registry(); reg = _registry(); a=reg + (cognumber << 2); // registry + cognumber *4 b=peeklong(a); // get the registry for this cog ff007fcc b = b & 0x0000ffff; // mask off upper two bytes c = (unsigned long) &p_array[0]; // pointer to p_array // printf("pointer value is %x \n",c); pokelong(b,c); // address,value 7fcc now contains a pointer to the p_array[0] // print7fcc(); } void init_lcd(int cognumber) { unsigned long lcd_array[10]; // temporary array for sending a string of data to the LCD int i; lcd_array[0] = 0x00000100; // command to initialise nnnn01nn lcd_array[1] = 0x0000020e; // cursor on lcd_array[2] = 0x00000201; // cls lcd_array[3] = 0x0000020d; // flashing cursor lcd_array[4] = 0x00000280; // top left hand corner lcd_array[5] = 0xffffffff; // finish command = -1 pass_plugin_data(lcd_array,cognumber); // tell the plugin where the data is external_plugin_cog_load(cognumber, cogject_plugin); // move plugin from external memory to cog 7 _sys_plugin(8, 1); // 8 is dummy plugin, and 1 is any non zero number for(i=0;i<80;i++) { lcddisplay[i]=32; // clear the buffer to spaces(common hub array) } lcddisplay[80]=0; // column 0-19 lcddisplay[81]=1; // line number 1,2,3 or 4 } void redraw(int cognumber) // redraw the entire screen { int linenumber; int n,m,i,j,c; unsigned long lcd_array[90]; // enough room to pass all 80 characters and start and finish linenumber = (int) lcddisplay[81]; // get the linenumber in a local variable n = (linenumber - 1) * 20; // convert to a pointer to the correct array location lcd_array[0] = 0x00000280; // instruction (02) and value (0x80 = 128 = line 1) lcd_array[21] = 0x000002c0; // instruction (02) and value (0xC0 = 192 = line 2) lcd_array[42] = 0x00000294; // instruction (02) and value (0x94 = 148 = line 3) lcd_array[63] = 0x000002d4; // instruction (02) and value (0xD4 = 212 = line 4) lcd_array[84] = 0x000002d4; // instruction (02) and value (0xD4 = 212 = line 4) at end lcd_array[85] = 0x0000020d; // flashing cursor lcd_array[86] = 0xffffffff; // finish command n=1; m=0; for(i=0;i<20;i++) { lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time m++; n++; } n=22; m=20; for(i=0;i<20;i++) { lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time m++; n++; } n=43; m=40; for(i=0;i<20;i++) { lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time m++; n++; } n=64; m=60; for(i=0;i<20;i++) { lcd_array[n]=lcddisplay[m]; // move in data 20 chars at a time m++; n++; } // load cog, send out all data, hand control back to catalina pass_plugin_data(lcd_array,cognumber); // tell the plugin where the data is external_plugin_cog_load(cognumber, cogject_plugin); // move plugin from external memory to hub ram _sys_plugin(8, 1); // and start it 8 is dummy plugin, and 1 is any non zero number } void newline(int cognumber) // move the line up by 1, clear line 4, move cursor to start of line 4 { int i; for(i=0;i<60;i++) { lcddisplay[i] = lcddisplay[i+20]; // shuffle up a line } for(i=60;i<80;i++) { lcddisplay[i] = 32; // spaces on the last line } lcddisplay[80]=0; // column = 0 redraw(cognumber); } void printf_lcd(int cognumber, char textstring[]) // note that this loads and unloads a cog to print just one char so do in a group if print a string { int col,i,length,p,overflow; unsigned long lcd_array[20]; // enough room to pass characters col = (int) lcddisplay[80]; // get the column number length = strlen(textstring); // printf("length is %i \n",length); overflow = col+length-20; // off the end? if (overflow <0) overflow = 0; for(i=0;i < length -overflow;i++) { lcddisplay[60 + col + i] = textstring[i]; // store in the screen buffer // printf("value of i is %i \n",i); } for(i=0;i < length - overflow;i++) { lcd_array[i] = textstring[i]; // print out } p = length; // pointer to where we are up to // printf("length is %i \n",p); if (col+length >19) { lcd_array[p] = 0x0000020c; // cursor off if last char on the line // printf("cursor off \n"); p++; } lcd_array[p] = 0xffffffff; // terminate command col = col + length; // printf("column is %i \n",col); lcddisplay[80] = (char) col; // put the column number back in the array pass_plugin_data(lcd_array,cognumber); // tell the plugin where the data is external_plugin_cog_load(cognumber, cogject_plugin); // move plugin from external memory to hub ram _sys_plugin(8, 1); // and start it 8 is dummy plugin, and 1 is any non zero number } //void backspace(int cognumber) //{ // backspace is a special case - need to subtract 1 off the column, make the last character a space // and redraw the screen and print out column number of characters on last line // only really works on line 4 but most of the time the display is on line 4 anyway // not working as yet // int col,i; // char tempstring[20]; // col = (int) lcddisplay[80]; // get the column number // if ((col>1) & (col<20)) // { // lcddisplay[col + 60] = 32; // was 1 past the character // col--; // } // lcddisplay[80] = (char) col; // put the column number back in the array // redraw(cognumber); // cursor to beginning of the last line // for(i=0;i<(col-2);i++) // { // tempstring[i]=lcddisplay[60+i]; // print out characters on the last line so cursor in the right place // } // tempstring[col-2] = 0; // terminator // printf("temp string is ",tempstring); // printf_lcd(cognumber,tempstring); //} void main () { printf("Test program to use the LCD on the dracblade with XMM catalina\n"); readcog("lcdplug.cog",cogject_plugin); // read from sd card into an external memory array init_lcd(7); // clear the screen, turn on the cursor redraw(7); // redraw the lcd, using driver in cog 7 newline(7); // scroll up a line strcpy(lineoftext, "Hello "); printf_lcd(7,lineoftext); // print string (reloads cog) strcpy(lineoftext, "World"); printf_lcd(7,lineoftext); // print string (reloads cog) newline(7); // scroll sleep(2000); redraw(7); // check same as on the display printf("Finish \n"); // printf("debug value @ 0x1000 = 0x%x \n",peeklong(0x1000)); // useful debug location while (1); // Prop reboots on exit from main() }
I just started to use Catalina 3.0 with ther latest patch.
But unfortunetly I can't make it compile
I followed the guide provided with the compiler.
C:\Program Files\Catalina>use_catalina =================== SETTING UP CATALINA =================== CATALINA_DEFINE = [default] CATALINA_INCLUDE = [default] CATALINA_LIBRARY = [default] CATALINA_TARGET = [default] CATALINA_LCCOPT = [default] CATALINA_TEMPDIR = [default] LCCDIR = [default] C:\Program Files\Catalina>cd demos C:\Program Files\Catalina\demos>catalina hello_world.c Catalina Compiler 3.0 1 dosya taşındı. Undefined or Redefined symbols: printf undefined[/COLOR] C:\Program Files\Catalina\demos>catalina hello_world.c -lc Catalina Compiler 3.0 1 dosya taşındı. [COLOR="red"]Homespun Spin Compiler 0.30 File not found[/COLOR] C:\Program Files\Catalina\demos
please help. whats wrong.
kind regards
Hi drRobutik
Odd. Catalina is working correctly, but homespun.exe is not - can you please tell me what version of Windows you are using?
Also, can you run your compile command with the -v switch and tell me what it says? I.e:
catalina hello_world.c -lc -v
Thanks,Ross.
I use win7 Ultimate in admin mod
C:\Program Files\Catalina\demos>catalina hello_world.c -lc -v Catalina Compiler 3.0 verbose mode calling lcc lcc command = lcc hello_world.c -lc -D__CATALINA_libc -Wl-Dlibc -Wl-v -o hello_ world -Wl-x0 -Wl-DTINY -D__CATALINA_TINY 1 dosya taşındı. Catalina Binder 3.0 verbose mode segment layout 0 defining TINY binding processing input file C:\Program Files\Catalina\target\lmm_progbeg.s processing input file C:\Program Files\Catalina\target\catalina_default.s processing input file C:\Users\SCANAN\AppData\Local\Temp\lcc54962.obj loading system library index C:\Program Files\Catalina\lib\libc\catalina.index files to process: C:\Program Files\Catalina\target\lmm_progbeg.s C:\Program Files\Catalina\target\catalina_default.s C:\Users\SCANAN\AppData\Local\Temp\lcc54962.obj files to include in output: C:\Program Files\Catalina\target\lmm_progbeg.s C:\Program Files\Catalina\target\catalina_default.s C:\Users\SCANAN\AppData\Local\Temp\lcc54962.obj C:\Program Files\Catalina\lib\libc\catalina_hmi_t_char.s C:\Program Files\Catalina\lib\libc\catalina_plugin_short.s C:\Program Files\Catalina\lib\libc\catalina_putc.s C:\Program Files\Catalina\lib\libc\data.s C:\Program Files\Catalina\lib\libc\doprnt.s C:\Program Files\Catalina\lib\libc\fltpr.s C:\Program Files\Catalina\lib\libc\icompute.s C:\Program Files\Catalina\lib\libc\modf.s C:\Program Files\Catalina\lib\libc\printf.s C:\Program Files\Catalina\lib\libc\putc.s C:\Program Files\Catalina\lib\libc\strcpy.s C:\Program Files\Catalina\lib\libc\strfmt.s C:\Program Files\Catalina\lib\libc\strlen.s C:\Program Files\Catalina\lib\libc\toupper.s C:\Program Files\Catalina\target\lmm_progend.s input libraries: libc Undefined or Redefined symbols: (none) bind output file is C:\Program Files\Catalina\target\Catalina.spin generating Code segment generating Cnst segment generating Init segment generating Data segment assembling hello_world target name = C:\Program Files\Catalina\target\lmm_default.spin assemble command (lmm) = homespun -b -D libc -D TINY "C:\Program Files\Catalina\ target\lmm_default.spin" -o hello_world Homespun Spin Compiler 0.30 File not found assemble command returned result 1 C:\Program Files\Catalina\demos>
I've finally given in and purchased a copy of Windows 7, so I will be able to support this platform better in future - but I only installed it today, so bear with me while I'm still learning
First, can you please check to see if the file C:\Program Files\Catalina\target\lmm_default.spin actually exists? If not, you have something wrong with your target directory, and you should re-install Catalina.
If it does exist, then the problem may be to do with where you have installed Catalina. On my new Windows 7 machine, I seem to have some some issues when Catalina is installed in the recommended directory (i.e. C:\Program Files\Catalina or C:\Program Files (X86)\Catalina).
However, I just moved the whole directory to C:\Catalina, and everything now seems to work correctly. To see if this helps you, move your entire Catalina directory from C:\Program Files\Catalina to C:\Catalina, then start a new command shell and enter the following commands:
cd C:\Catalina set LCCDIR=C:\Catalina use_catalina cd demos catalina -lc hello_world.c
Try this and see if it helps.Ross.
yes the lmm_default.spin is in the target directory
C:\Catalina>set LCCDIR=C:\Catalina C:\Catalina>use_catalina =================== SETTING UP CATALINA =================== CATALINA_DEFINE = [default] CATALINA_INCLUDE = [default] CATALINA_LIBRARY = [default] CATALINA_TARGET = [default] CATALINA_LCCOPT = [default] CATALINA_TEMPDIR = [default] LCCDIR = C:\Catalina C:\Catalina>cd demos C:\Catalina\demos>catalina -lc hello_world.c Catalina Compiler 3.0 1 dosya taşındı. Homespun Spin Compiler 0.30 File not found C:\Catalina\demos>
Okay - try executing the homespun command manually from the demos directory:
cd C:\Catalina\demos homespun "C:\Catalina\target\lmm_default.spin" -D TINY
And tell me what you get.Unfortunately same result..
Have you modified the Catalina installation in any way? Could you re-install a clean copy of Catalina from the original zip into a new directory (e.g. unzip it to to C:\Catalina2) and then open a command prompt and execute the following:
cd C:\Catalina2 set LCCDIR=C:\Catalina2 use_catalina cd demos catalina -lc hello_world.c
This works for me first time.
I'll be out of contact for about an hour - I'll check back in then.
Ross.
I downloaded again from sourceforge
unziped and install in the c:\ dairectory as catalina2
and did what you say and teh result is
[code]Microsoft Windows [S
Yes, this is very odd. Windows 7 seems to be a bit weird. Can you try the following:
cd C:\Catalina2 set LCCDIR=C:\Catalina2 use_catalina cd target homespun lmm_default.spin -D TINY
and report the results?Ross.
I can confirm that there is some really odd behaviour under Windows 7. I have not yet managed to track it down, but it seems that occasionally the file lmm_default.spin is being corrupted. I will investigate further tomorrow. In the meantime, can you please post the current contents of your lmm_default.spin file?
Ross.
I tried what you said on a XP machine too
but I get the result.
I ll gonna be crazy
what can be wrong;?
As yet, I have no idea!
I've seen some wierd things in the last day or so under Windows 7, but never under XP.
I plan to investigate this today, so bear with me. Can you please post the lmm_default.spin file from your target directory? That may give me a clue. I managed to corrupt mine once, but before I realized what was going on, I overwrote it with a new copy.
Ross.
There is another minor oddity which I just noticed with Windows 7 - when you set LCCDIR (which you need to do if you installed Catalina in a non-standard directory), you have to make sure you don't include any quotation marks - e.g. you must say:
set LCCDIR=C:\Program Files (x86)\Catalina
and notset LCCDIR="C:\Program Files (x86)\Catalina" <--- WRONG!
I think the latter works under XP - but it doesn't work under Windows 7.Ross.
I've been trying since yesterday to reproduce the strange behaviour drRobutik has reported seeing under Windows 7. Apart from one problem with the catalina_env batch file (see previous post), I can't make Catalina behave the way drRobutik is reporting. I've reinstalled it several times to different locations, and tried compiling many programs - and they all seem to compile and run correctly.
Has anyone else seen any weird problems using Catalina under Windows 7?
I did see one instance of odd behaviour yesterday, but I have been unable to reproduce it, and I now think it may have been because I was still in the middle of installing all the zillions of Windows 7 patches (how can there be so many already???). Anyway, I now seem to have them all installed, and everything seems to be working reliably.
Any help would be appreciated!
Ross.
I think I have found a clue to the bizarre behaviour of Windows 7. I think you may be running into problems with the Windows 7 VirtualStore feature. This web site shows how to disable VirtualStore for a particular application: http://www.twcenter.net/forums/showthread.php?t=397636
I chose to use solution 3 - essentially, you give users "full control" and "modify" rights to the Catalina directory, and then delete the contents of any existing Catalina VirtualStore folders.
Please try this and see if it fixes your problem.
Ross.
Tried everything you have given,
but still Win7 insist to not compile
still same problem..
Hi drRobutik,
This is a bit of a mystery. You haven't yet posted your lmm_default.spin file from your target directory. Can you do that please? This may give me a clue.
Then try the following (please substitute your installation directory for C:\Program Files\Catalina in the following commands):
1. Check whether Homespun can compile simple Spin files. There is one in the Catalyst demo folder:
cd C:\Program Files\Catalina set LCCDIR=C:\Program Files\Catalina use_catalina cd catalyst\demo homespun demo.spin
2. Check whether it is only the lmm_default.spin file that is affected:cd C:\Program Files\Catalina set LCCDIR=C:\Program Files\Catalina use_catalina cd demos catalina -lc -D LARGE hello_world.c
3. Check whether Homespun can find lmm_default.spin when it is in the same directory:cd C:\Program Files\Catalina set LCCDIR=C:\Program Files\Catalina use_catalina cd target homespun lmm_default.spin -D TINY
Thanks,Ross.
C:\Users\Public\storage\catalina\demos>catalina -lc -DLARGE hello_world.c Catalina Compiler 3.0 1 個のファイルを移動しました。 <-- [COLOR="blue"]telling you it moved one file[/COLOR] [COLOR="red"]cannot open temporary files[/COLOR] Homespun Spin Compiler 0.30 parsing C:\Users\Public\storage\catalina\target\xmm_default.spin ...
I haven't encountered a File not found yet.Hi kuroneko,
Thanks for doing that. The problem you are seeing with step 2 is a different problem. I think this is because the account you are using does not have write permission to the Catalina target directory.
The steps I described earlier to remove the VirtualStore functionality on Catalina also gives all users "modify" access to the Catalina directory, so this should fix that.
If that does not fix it, then it may also be because Catalina does not have write access to the directory where it expects to create temporary files. You can set this directory two ways:
1. By adding -W-tempdir=<temp dir> to each compile command. For example:
catalina -lc hello_world.c -W-tempdir=.
2. By doing a "one off" setup it in your CATALINA_TEMPDIR environment variable. For example:set CATALINA_TEMPDIR=. catalina -lc hello_world.c
Ross.the catalina directory is in a public area. So write access isn't an issue. Even specifically setting the rights for the directory (full control) doesn't change anything. Neither does specifying a different temporary directory (env or command line). If it bothers you could you send me a debug version which displays the path to the temporary file(s) it cannot open?
Update: I must admit that I didn't install Catalina under C:/Program Files/Catalina (none of my 3rd party stuff is). So if one or more of the environment defaults rely on that location then this could be an issue. What are the exact locations to override the defaults?
Just read in the manual that setting LCCDIR to a different location should have taken care of that ... most odd. Anyway, homespun itself didn't and still doesn't have problems creating files in that (public) hierarchy so why should catalina?
Yes, just set LCCDIR. If you still can't get it working, let me know. I'm still learning all the tricks and traps with Windows, so any feedback on problems/fixes is very useful.
Ross.
I don't need to - just try using a command like:
catalina -lc hello_world.c -D LARGE -v -W-v
The -v tells catalina to be verbose. The -W-v tells LCC to be verbose. Can you post the output?Thanks,
Ross.
C:\Users\Public\storage\catalina\demos>catalina -lc hello_world.c -D LARGE -v -W-v Catalina Compiler 3.0 verbose mode passing option -v calling lcc lcc command = lcc -lc -D__CATALINA_libc -Wl-Dlibc hello_world.c -v -Wl-v -o hello_world -tempdir=C:\Users\Public\storage\catalina\t emp -Wl-x5 -target=catalina_large/win32 -Wl-DLARGE -D__CATALINA_LARGE -LC:\Users\Public\storage\catalina\large_lib lcc $Id: lcc.c 355 2007-02-18 22:08:49Z drh $ C:\Users\Public\storage\catalina\bin\cpp.exe -U__GNUC__ -D_POSIX_SOURCE -D__STDC__=1 -D__STRICT_ANSI__ -Dwin32 -D_WIN32 -D_M_IX86 -D __extension__= -D__cdecl= -D__CATALINA__ -D__LCC__ -D__CATALINA_libc -D__CATALINA_LARGE -IC:\Users\Public\storage\catalina\include h ello_world.c C:\Users\Public\storage\catalina\temp\lcc50680.i C:\Users\Public\storage\catalina\bin\rcc.exe -target=catalina/win32 -v -o hello_world -target=catalina_large/win32 C:\Users\Public\s torage\catalina\temp\lcc50680.i C:\Users\Public\storage\catalina\temp\lcc50681.s C:\Users\Public\storage\catalina\bin\rcc.exe $Name$($Id: main.c 355 2007-02-18 22:08:49Z drh $) cmd.exe /c move C:\Users\Public\storage\catalina\temp\lcc50681.s C:\Users\Public\storage\catalina\temp\lcc50682.obj 1 個のファイルを移動しました。 C:\Users\Public\storage\catalina\bin\catbind.exe -o hello_world -LC:\Users\Public\storage\catalina\lib -TC:\Users\Public\storage\cat alina\target -Dlibc -v -x5 -DLARGE -LC:\Users\Public\storage\catalina\large_lib -lc C:\Users\Public\storage\catalina\temp\lcc50682.o bj Catalina Binder 3.0 verbose mode segment layout 5 defining LARGE library path = C:\Users\Public\storage\catalina\large_lib binding processing input file C:\Users\Public\storage\catalina\target\xmm_progbeg.s processing input file C:\Users\Public\storage\catalina\target\catalina_default.s processing input file C:\Users\Public\storage\catalina\temp\lcc50682.obj loading system library index C:\Users\Public\storage\catalina\large_lib\libc\catalina.index files to process: C:\Users\Public\storage\catalina\target\xmm_progbeg.s C:\Users\Public\storage\catalina\target\catalina_default.s C:\Users\Public\storage\catalina\temp\lcc50682.obj files to include in output: C:\Users\Public\storage\catalina\target\xmm_progbeg.s C:\Users\Public\storage\catalina\target\catalina_default.s C:\Users\Public\storage\catalina\temp\lcc50682.obj C:\Users\Public\storage\catalina\large_lib\libc\catalina_hmi_t_char.s C:\Users\Public\storage\catalina\large_lib\libc\catalina_plugin_short.s C:\Users\Public\storage\catalina\large_lib\libc\catalina_putc.s C:\Users\Public\storage\catalina\large_lib\libc\data.s C:\Users\Public\storage\catalina\large_lib\libc\doprnt.s C:\Users\Public\storage\catalina\large_lib\libc\fltpr.s C:\Users\Public\storage\catalina\large_lib\libc\icompute.s C:\Users\Public\storage\catalina\large_lib\libc\modf.s C:\Users\Public\storage\catalina\large_lib\libc\printf.s C:\Users\Public\storage\catalina\large_lib\libc\putc.s C:\Users\Public\storage\catalina\large_lib\libc\strcpy.s C:\Users\Public\storage\catalina\large_lib\libc\strfmt.s C:\Users\Public\storage\catalina\large_lib\libc\strlen.s C:\Users\Public\storage\catalina\large_lib\libc\toupper.s C:\Users\Public\storage\catalina\target\xmm_progend.s input libraries: libc Undefined or Redefined symbols: (none) bind output file is C:\Users\Public\storage\catalina\target\Catalina.spin [COLOR="red"]cannot open temporary files[/COLOR] assembling hello_world target name = C:\Users\Public\storage\catalina\target\xmm_default.spin assemble command (target) = homespun -b -D libc -D LARGE C:\Users\Public\storage\catalina\target\xmm_default.spin -e -o C:\Users\Pub lic\storage\catalina\target\xmm_default Homespun Spin Compiler 0.30 parsing C:\Users\Public\storage\catalina\target\xmm_default.spin parsing C:\Users\Public\storage\catalina\target\Catalina_Common.spin parsing C:\Users\Public\storage\catalina\target\Catalina_HUB_XMM_Loader.spin parsing C:\Users\Public\storage\catalina\target\Catalina_XMM.spin parsing C:\Users\Public\storage\catalina\target\Catalina_HMI_Plugin_HiRes_Tv.spin parsing C:\Users\Public\storage\catalina\target\Catalina_comboKeyboard.spin parsing C:\Users\Public\storage\catalina\target\Catalina_comboMouse.spin parsing C:\Users\Public\storage\catalina\target\Catalina_mouse.spin parsing C:\Users\Public\storage\catalina\target\Catalina_HiRes_TV_Text.spin parsing C:\Users\Public\storage\catalina\target\TV_Half_Height.spin parsing C:\Users\Public\storage\catalina\target\Catalina_CogCount.spin parsing C:\Users\Public\storage\catalina\target\Catalina_Float32_A_Plugin.spin parsing C:\Users\Public\storage\catalina\target\Catalina_CogStore.spin compiling xmm_default.spin compiling Catalina_HUB_XMM_Loader.spin compiling Catalina_XMM.spin compiling Catalina_HMI_Plugin_HiRes_Tv.spin compiling Catalina_comboKeyboard.spin compiling Catalina_comboMouse.spin compiling Catalina_mouse.spin compiling Catalina_HiRes_TV_Text.spin compiling TV_Half_Height.spin compiling Catalina_CogCount.spin compiling Catalina_Float32_A_Plugin.spin compiling Catalina_CogStore.spin compiling Catalina_Common.spin writing 32768 bytes to C:\Users\Public\storage\catalina\target\xmm_default.eeprom assemble command (emm, smm or xmm) = homespun -b -D libc -D LARGE C:\Users\Public\storage\catalina\target\Catalina.spin -M 65536 -o hello_world Homespun Spin Compiler 0.30 parsing C:\Users\Public\storage\catalina\target\Catalina.spin No PUB routines found in Catalina.spin assemble command returned result -1 output will not be combined with target rm C:\Users\Public\storage\catalina\temp\lcc50682.obj C:\Users\Public\storage\catalina\temp\lcc50680.i C:\Users\Public\storage\catal ina\temp\lcc50681.s C:\Users\Public\storage\catalina\demos>
Blast! - that version doesn't print the names of the tmp files themselves. Can you unzip the attached version of catbind.exe into your Catalina bin directory and try that command again?
Thanks,
Ross.