system function call
javelin
Posts: 18
in Propeller 1
Hello all.
First off, I'm not a developer. Now that I got that out of the way, below is my issue.
So I have a small C program that list directory contents. If I run that from the CMD, it works fine and does what it supposed to do.
C:\...>ListDirectoryExe
Volume in drive C has no label.
Volume Serial Number is E4A9-F680
Directory of ...
12/29/2019 12:13 PM <DIR> .
12/29/2019 12:13 PM <DIR> ..
12/29/2019 12:10 PM 38,912 ListDirectoryExe.exe
...
...
9 File(s) 1,465,670 bytes
3 Dir(s) 385,429,344,256 bytes free
Here's my code calling ListDirectoryExe:
#include "simpletools.h"
#include <stdlib.h>
int main()
{
system("ListDirectoryExe")
}
When I run Build, it fails on the following:
In function `_main':
(.text+0x6): undefined reference to `_system'
Am I using system() correctly or am I missing to declare or define something? Any help is appreciated.
First off, I'm not a developer. Now that I got that out of the way, below is my issue.
So I have a small C program that list directory contents. If I run that from the CMD, it works fine and does what it supposed to do.
C:\...>ListDirectoryExe
Volume in drive C has no label.
Volume Serial Number is E4A9-F680
Directory of ...
12/29/2019 12:13 PM <DIR> .
12/29/2019 12:13 PM <DIR> ..
12/29/2019 12:10 PM 38,912 ListDirectoryExe.exe
...
...
9 File(s) 1,465,670 bytes
3 Dir(s) 385,429,344,256 bytes free
Here's my code calling ListDirectoryExe:
#include "simpletools.h"
#include <stdlib.h>
int main()
{
system("ListDirectoryExe")
}
When I run Build, it fails on the following:
In function `_main':
(.text+0x6): undefined reference to `_system'
Am I using system() correctly or am I missing to declare or define something? Any help is appreciated.
Comments
If you are running the c program from cmd, then Windows is executing it. If you are running it on the propeller, then the propeller cannot use system().
I currently have two Prop Activiy Boards one with wifi which I programmed to help monitor and captured a ground mole; yes it works with the help of the wifi; when it got triggered, it sent me a http message to my iphone : )
I'm done with the mole thing and I've another idea which brought me to system().
I see that if system() was supported, it can be useful in so many ways; if something is triggered on Pin X, do system(myapp) for example.
Any idea why system() not supported?
Things become more complicated if you want to have multiple programs running at the same time. The Spinix OS does this by running programs written in Spin, which can be easily relocated in RAM.
Will have to think about this more and see if there's another way to do it.
Thanks everyone for your valuable input...always appreciated.
jav
I once wrote a tiny Python script for a TV commercial to demonstrate the speed of SSD over a spinning drive. When the PC booted it ran the script that sent a serial message to a Propeller board which changed the color of a light and then unlocked a box using a servo. Inside the box was a paintball gun. Needless to say, the person with the fastest PC (SSD) got to their paintball gun first and could shoot the daylights out of the other guy.
I like your demo though and I take it you got to your paintball gun first : ) My process would be the opposite; the prop board would send a signal to the running OS(through some method, serial or otherwise), windows or *nix, and then it takes off from there.
I'm looking at the three Python Cookbooks on my shelf and I'm almost afraid to touch them hehee