mstimer always zero with XMMC External Flash Code Main Ram Data
BlackSoldierB
Posts: 45
I am trying to use the timer in combination with the XMMC memory. I use this memory, because my libaries require a lot of memory.
My timer outputs always zero. Is the timer supposed to work with the XMMC memory or am i missing something?
This is my test code:
EDIT:
I thought i had read somewhere that cogstart cannot be used in the XMMC mode.
I looked in the "mstimer.c" file and saw that they where using the CNT variable.
This is my code with CNT, is this correct?
My timer outputs always zero. Is the timer supposed to work with the XMMC memory or am i missing something?
This is my test code:
#include "simpletools.h" #include "mstimer.h" int main() { low(26); low(27); mstime_start(); print("Starting\n"); high(26); //For loop to increase the time. for(int i = 0; i < 1000; i++) { print("%d", i); } print("\n"); int time = mstime_get(); mstime_stop(); print("Total time= %d", time); high(27); return 0; }
EDIT:
I thought i had read somewhere that cogstart cannot be used in the XMMC mode.
I looked in the "mstimer.c" file and saw that they where using the CNT variable.
This is my code with CNT, is this correct?
#include "simpletools.h" int main() { low(26); low(27); print("Starting\n"); high(26); unsigned int ticks = CNT; print("Tick %u\n", ticks); for(int i = 0; i < 1000; i++) { print("%d", i); } print("\n"); unsigned int ticks2 = CNT; print("Total time= %u, ticks: %u", ticks2 - ticks, ticks2); high(27); return 0; }
Comments
Function mstime_start() uses cogstart(). As you mentioned, XMMC in the Propeller C release does not allow using cogstart().
There are some alternatives of course. Maybe you application doesn't need a separate COG. What are you trying to time?
This also means that i can't use the abdrive libary right?
I am planning to use the drive_goto function but that also uses the cogstart function. Is for this problem a workaround?
The board types have changed significantly. Which board type are you using? What is your XMM code storage device?
If you want to try it out, in this thread is a link to windows binaries:
http://forums.parallax.com/showthread.php/154283-problem-when-using-propeller-load-with-xmmc-or-xmm-single-(propgcc-default-branch)/page2
You have to go to message #34. With this version you can use libraries which use cogstart. Maybe you have to change the stack size in the source code.
I am using windows and i have a ActivityBot with a SD Card.
How do i know if the data and/or stack is stored on the SD Card or in the EEPROM?
Awesome! I will download it and try to get it working.
EDIT:
Is it true that the boardtype "ActivityBot" stores the data/stack in the EEPROM and the boardtype "ActivtyBot -SDXMMC" on the SD Card?
I am currently using the boardtype "ActivityBot".
EDIT2:
Can i just replace compiler location in the Simple IDE or will that introduce complications?
One final question, when do i have to use "Load EEPROM & Run", "Load RAM & Run" and "Run with terminal"?
The only thing stored in the external device is code and initial values of data. It is read-only. Everything else is in HUB RAM.
No. See my response above.
Yes. That is the main reason for having that in the Properties window.
"Load RAM & Run" and "Run with terminal" will not write startup code to EEPROM. So, your program will not boot if you reset the board. Using "Load EEPROM & Run" will make it so that your program will boot reset or power-cycle.
Do i need to recompile the libaries with the "new" compiler in order to make the "cogstart" work? Or is recompiling my own project sufficient?
EDIT:
The compiler settings (from the properties screen) change back to default when i restart the SimpleIDE. Is this a bug or a feature?
I recompiled all the libaries that are required by the first code i posted, but the timer still outputs 0.
The compiler settings reverting is a bug - we haven't had a good reason to test that in a long time. As long as you have it set after restarting the IDE, your compile should work.
Did you compile libraries with the compiler set properly?
And is there an easy way to compile all the libaries with different settings?
Edit:
The log of the SimpleIDE produces "propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2162)" while the new compiler produces this with the -v option "gcc version 4.6.1 (propellergcc-alpha_v1_9_0_2365)".
So i quess it is compiling with the default compiler.
This is my settings screen:
What am i doing wrong?
Leave the path settings untouched (default values).
So you did more or less an overwrite?
EDIT:
The compilation worked, but the timer and multicore led exmples are still not working. Any tips or "working" examples?
@trancefreak is right about replacing the propgcc folder. I totally forgot about the GCC toolchain relying on the PATH environment variable. Sorry about that.
Anytime you use cogstart in XMMC mode, you need to pass a big stack so that the function will have some space for running.
In addition to that, there is a bug in Andy's ms_timer.c code that causes "52 second counter miss delay" because XMMC can be slower than CMM/LMM.
Below is a corrected ms_timer.c ... you will need to build the library for CMM, LMM, and XMMC. Please don't use XMM-SINGLE and XMM-SPLIT.
After building my mstimer library I was able to run the code from the first post no problems with the default branch.
--Steve
What do you mean with the default branch? Is that the compiler or library branch?
To get the abdrive library i need to also add the extra stack size.
Is this correct?
I do get 'EXTRA_STACK_LONGS' undeclared here (not in a function). This is probably because i don't the latest branch.
The default branch of the Google Code propgcc project. There isn't a separate branch for the propgcc library. Maybe you're talking about the Simple Libraries? They are not part of propgcc at the present. When I say "library", I'm talking about the propgcc library not Simple Libraries.
EDIT: I am currently installing debian on a virtualbox machine.
https://code.google.com/p/propgcc/
1. PropellerGCC has a standard libraries (different from Simple Libraries). David pushes code to the "default branch" that has PropellerGCC and the standard library.
2. SimpleIDE normally uses PropellerGCC "release_1_0 branch", and a separate Simple Library (includes ms_timer) which Parallax developed for it's educational program.
A default branch package for windows is posted here:propellergcc-alpha-1_9_0-i686-windows
If you must build PropellerGCC from scratch (deep end of the pool):
Configuring a system to build PropellerGC can be painful. The prerequisites here. Updated build instructions are here.
EDIT: The propeller-elf.gcc is availible in the /opt/parallax/bin/ directory. Maybe a PATH variable that is not correct?
Seems I may have forgotten a step.
It should say:
For default branch cross-compile to Windows
$ make clean-all
$ make
$ make CROSS=win32
$ Go eat lunch.
EDIT: Arg, not enough disk space. Resizing it now.
EDIT2: The linux build is done, building for Windows now.
And
Do i need to do this steps?
Linux/Mac
- Set a GROUP variable.
- su root (or use sudo for the following commands through "exit root")
- $ export GROUP="your group"
- $ rm -rf /opt/parallax
- $ mkdir /opt/parallax
- $ chown ${USER}.${GROUP} /opt/parallax
- $ chmod g+w /opt/parallax
- exit root
For release_1_0 branchAny tips for this problem?
I'm sorry I didn't see your post earlier. I've been away from my computer a lot over the last 5 days.
Set your path? export PATH=/opt/parallax/bin
It may be useful to check your repository for diffs. $ hg diff
If you have diffs, do this $ hg revert all
Assuming you are building the default branch
$ make clean-all
$ make
I took the following actions with root rights.
1. I deleted the /opt/parallax and /opt/parallax-win32 folders.
2. I deleted the build and build-win32 folder.
3. I did the "hg diff" and "hg revert --all" commands
4. Created /opt/parallax/
5. chmod 777 /opt/parallax/
6. PATH=${PATH}:/opt/parallax/bin and export PATH=/opt/parallax/bin:${PATH}
7. make -clean
8. make
9. make CROSS=win32
The linux variant was build without errors.
For the windows variant i got:" undefined reference to `_usleep'".
The other error seem to be solved.
Do i have to do chmod 777 /opt/parallax-win32/ aswell? Or do i need to add /opt/parallax-win32/ to the $PATH variable?