How to run Propeller?
Alarus
Posts: 48
How to run Propeller?
What is the first address for the program 0x0000 - 0x000F?
How many clock cycles it takes to copy the program to the Cog?
Can the program in assembly language to be more 0x1F0?
How is the loading of programming in entered from the main memory?
Thanks in advance.
What is the first address for the program 0x0000 - 0x000F?
How many clock cycles it takes to copy the program to the Cog?
Can the program in assembly language to be more 0x1F0?
How is the loading of programming in entered from the main memory?
Thanks in advance.
Comments
I try not to give RTFM answers to questions here but given that it looks like your getting to know the Propeller for the first time you owe it to yourself to start by reading the Propeller Manual.
Your questions can have rather deep and long answers but as you are starting out you probably don't even need to know yet for the purposes of getting the device working and getting a feel for the device and the Propeller Tool.
welcome to the propeller-forum.
there are two very different operation modes the cogs are working:
1: interpreting SPIN if you start SPIN-code
the SPIN-intepreter is loaded into the cog. All data and commands are taken frum the shared HUB-RAB (32kB)
2: running Propeller-Assembler PASM: your assembler-code gets loaded from HUB-RAM to COG-RAM and starts.
I don't know how many clockcycles this takes if I remember right it is in the microseconds range. (transferring 512 longs from HUB-RAM to cog-RAM.
So for more detailed answers. Would you like to code in SPIN or PASM?
best regards
Stefan
Q: How to run a Propeller?
A: For beginners: buy one of Propeller board, install Propeller Tool or BST on your PC, connect the board with the PC with USB cable, add power supply if needed and start learning how to write programs for it.
Q: What is the first address for the program 0x0000 - 0x000F?
A: If I can remember, $0010. You don't need this information, simply write your program and Spin compiler will do the rest
Q: How many clock cycles it takes to copy the program to the Cog?
A: About 8000 cycles
Q: Can the program in assembly language to be more 0x1F0?
A: In normal mode, no. Cog has only $1F0 longs of program memory. There is LMM/XMM mode in which you can use longer asm programs.
Q: How is the loading of programming in entered from the main memory?
A. Use coginit or cognew. It loads program from main memory to cog memory and starts its execution from $0 address in cog memory.
These are quick answers. Download and read a Propeller manual.
My question is similar to a beginner, but have a deep meaning.
I have a QuickStart board training. Questions arose when I wrote the program more 496 long words in assembler.
I found out that the program is loaded during the 496 x 16 + 12 x 4 = 7984 cycles.
16 cycles required to obtain a window from the main memory.
12 teams (4 cycles per team) cleaning special registers.
0x0000 in the address is the system bus.
My program runs from 0x18 address. The manual says that to a 0x10.
This varies with the size/structure of your program. So don't rely on hard-wried offsets too much.
You either know how many cycles it takes to download the program or do not know.
I can say that it takes 7900 cycles to load, but it would not be correct as 8000.
And what model LMM XMM?
In the Propeller Tool, I did not find them.
Check out [thread=89640]this thread[/thread], AFAIK this is how it all began.
To use the LMM and XMM need to download a special operating system that will be loaded into the memory of the program.
And there is no mechanism for loading the program into memory Cog from main memory or Spin provides such a mechanism.
http://obex.parallax.com/objects/635/
LMM is supported by PropBasic.
Propeller-GCC, and Catalina support LMM and XMM modes.
Propeller-GCC has an assembler that supports COG and LMM assembly.
There is also an LMM assembler called LAS, but I've never used it successfully.
LMM allows up to about 32KB of instructions.
XMM is based on storing instructions in some external memory.
Propeller-GCC allows up to 256MB of XMM/XMMC instructions.
Spin provides mechanism to load PASM in COG cores with "cognew"
do you think 496 longs for high-speed drivers and 32kB SPIN-bytecode (which is more compact than f.e. c-code) for human interface is enough for what you are planning to do?
If not switch over to another processor that provides more RAM.
best regards
Stefan
As a command Cognew also loads 496 long words from main memory or a single method?
Who knows what is in the address $0000 - $000F main memory.
I found out that the $0000 - this is the system bus frequency in Hertz.
Thanks in advance.
Attached is a description of the format of a Spin program including a description of the 16 byte preamble to the program that's stored in locations $00 to $0F of main memory (and the 1st 32K of the program EEPROM). The ROM bootloader uses this information when starting up the initial Spin interpreter in a cog. This information has been documented in several places. This happens to be an early copy I have around.
Definition of the·initialization section (first 16 bytes) of the eeprom file
Bytes :
0-3 Clock speed
4 : Clock Mode
5 : Checksum
6-7 : PBase - Start of object
8-9 : VBase - Start of Variables
10-11 : DBase - Start of Stack
12-13 : PCurr - Pointer to start of first spin object to run
14-15 : DCurr - Stack pointer
I use the following PASM line to get the system clock frequency and it works okay
rdlong count, #0
Sandy
Now many of the points are clear.
Is there a good simulator Propeller.
I managed to find only Gear 1.11.0.0.
In most cases, I've found it easier to debug on the Propeller itself. You can start up a VGA or TV text display in one cog and dedicate portions of the display buffer to any of several cogs. In assembly, it's relatively easy to take a value and convert it to hex for display in a few instructions so you can monitor data values. If you're writing in Spin mostly, it's even easier to make up complex displays of internal values.
Note: the contents of $0000-$000F are set by the bootloader & SPIN interpreter - not by the hardware. Thus, LONG[0] & LONG[4] is only the correct if the constants are set correctly in the SPIN file and the SPIN CLKSET command is used to change the clock settings.
the quick and dirty method is:
if the method you are starting with has 1 to 3 parameters and only a few nested calls will occure choose a stacksise of 20-50 longs.
If you have a lot of nested calls choose 200-1000 longs (depending on how much RAM you have left over)
the quite serious and reliable method is
http://obex.parallax.com/objects/25/
The scientific precise answer is:
analyse all the possible variations of nested calls of methods and all their parameters that can occure (and might occure in future when you change the code)
and then there is surely (somewhere documented how many longs this will take)
If I'm allowed to make a personal statement:
you seem to be a perfectionist. You want to know it all before writing even the first line of code.
If you do this as you're hobby everything is alright. If you try to work this way in a buissenes three other
people that have the courage to get started easily will overtake you and beeing paid for beeing successful while you are still analysing
some more details.
Anyway to come close to the optimal number of longs needed for the stack there is this object to analyse this (empirical)
mentioned above
best regards
Stefan
I'm just very lazy and do everything once.
Better to lose a week to the study, than a month fight the bugs.
I certainly appreciate your effort. Many people have similar questions to yours after studying the manual.
There will be more questions I'm sure and many others will ask instead of immediately discounting the chip.
Propeller is very interesting to study.
If you do it this way this is efficient too.
best regards
Stefan
no the propellertool creates bytecode out of a spin-sourcefile. The SPIN (=bytecode) interpreter (written in PASM) is loaded into a cog and then the interpreter starrts fetching bytecode
from HUB-RAM interpreting the bytecode. As SPIN is compiled to bytecode it is more space-efficient than high-language code comiled to native code. You win memory on the cost
of execution-speed.
best regards
Stefan