Shop OBEX P1 Docs P2 Docs Learn Events
Standards for hardware, file types and OS features, please chime in - Page 2 — Parallax Forums

Standards for hardware, file types and OS features, please chime in

24567

Comments

  • hippyhippy Posts: 1,981
    edited 2008-06-22 05:20
    Phil's "constant object" is a good work round to get what I was thinking of, especially as OBC notes the XTAL configuration can be imported.

    For the definitions in pindefs, I would not have any DAT, only constant definitions ( IP_ADDR0=192, IP_ADDR1=168 etc ). Anyone needing to have a DAT can build it from those constants. I would also have a definition for every I/O line. For the keyboard and mouse that's two lines, CLK and DAT, and they may not be in order nor contiguous across hardware platforms. For PAL/NTSC selection, simple boolean flags, PAL=True, same for interlaced, broadcast etc.

    Naming "annoyances" shouldn't be a problem. Someone who doesn't like the choice of names can create their own object as an abstraction layer which imports and passes the pindefs names up as named constants they like. Other programmers who like the naming convention will have imported pindefs directly.
  • vampyrevampyre Posts: 146
    edited 2008-06-22 05:21
    wow i really like the direction this is going
    A lot of people seem to be interested.


    I have one question about the spin object file
    how would an application know if hardware its looking for isn't hooked up?

    (poll was pre-mature, and will be reposted for new votes when new ideas stop showing up)

    Post Edited (vampyre) : 6/23/2008 8:43:01 PM GMT
  • AribaAriba Posts: 2,687
    edited 2008-06-22 06:21
    What I miss:
    - Software-USB D+, D-, PullUp Pins
    - Servos Basepin (and Number of Servos)

    Are this Left,Right Up... constants for NES not provided by the NES driver? I think we should only define Pins, Clock settings and Modes, not specific driver constants.

    And for the DS1302: why not RTC_CS, RTC_INIO ... so you can also use a DS1307 or others.

    For the IP address: a constant IP_ADDR = 192 + 168<<8 + 1<<16 + 200<<24

    PAL/NTSC: a constant PAL_MODE = 0 | 50 | 60 '0=NTSC, 50/60 = PAL with 50 or 60 Hz.


    Andy
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-06-22 06:59
    Here's a question, when you make a zip file of your project it will pick up your config file. That means that when someone else unzips the project they will have your config file and the compiler will use your config file instead of theirs unless you delete the one from the zip file. Anyone got any good ideas except for deleting the file when you download the object?
  • vampyrevampyre Posts: 146
    edited 2008-06-22 08:09
    how bout adding a dummy config file. one that wont compile and gives errors, but has examples commented out
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-06-22 08:43
    But if it doesn't compile than you can't use the Archive function. Maybe we just need to put a warning up the top of the main file somewhere.
  • hippyhippy Posts: 1,981
    edited 2008-06-22 13:06
    how would an application know if hardware its looking for isn't hooked up?

    That goes with setting a pin to -1 to indicate that hardware doesn't exist and relying on the program to check the pin is valid before using it. Without conditional compilation that means extra run-time checking, but cannot be avoided at present.

    If you mean, how does the program know if hardware which is expected to be there is plugged-in or not, that will mean probing the hardware to see if it's present ( may not always be possible ) or the end user must edit their pindefs / select the right pindef to match what they actually have at the time.

    the compiler will use your config file instead of theirs unless you delete the one from the zip file

    I think we'll have to live with that unless PropTool changes. The end user can keep their pindefs in the PropTool library file so that will automatically be used once the pindefs file in the downloaded local directory is deleted.


    Both cases are where integration within PropTool would be beneficial ( a pindef editor pop-up would beat manually editing the files for many people ) but if that's not going to happen we have to make the best of what there is. With Propellent available it shouldn't hopefully be too long before we see alternative IDE's which can better deal with things the PropTool cannot. As they'll be just front-end GUI editors rather than home-grown 'maybe not quite exactly the same as PropTool' compilers, there should be considerable less resistance to using them over PropTool.

    In this case, a third-party IDE can copy the selected pindef over "pindefs.spin" in the current directory before invoking Propellent, so that will get round that problem. It also means someone who hasn't got such an IDE and no clue about this pindef stuff can edit the pindef file as they'd normally edit the CON block so it's the best of both worlds.
  • ColeyColey Posts: 1,110
    edited 2008-06-22 13:07
    stevenmess2004 said...
    Didn't Coley figure out a way recently to tell what board someone was using based on the different keyboard ports?

    Here is the link http://forums.parallax.com/showthread.php?p=715732

    At the moment it only tests for differences between Hybrid and Hydra but could easily be expanded to check for Demoboard.

    Unfortunately I don't know how you could do this for Protoboard as it doesn't have any hardware already committed.

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-06-22 16:09
    Let put all this knowledge together and get a solid PinDefs standard created.

    Please share your input!

    propeller.wikispaces.com/PinDefs.spin

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange
  • PraxisPraxis Posts: 333
    edited 2008-06-22 16:36
    I am currently writing a spin preprocessor to provide conditional compiling, #Include etc.

    This is a command line exe that when called processes the spin file and then passes it to the propellent dll for compiling/downloading etc.

    The downside of this approach is non standard spin source code and the requirement of a third party IDE.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-06-22 17:23
    stevenmess2004 said...
    Here's a question, when you make a zip file of your project it will pick up your config file. That means that when someone else unzips the project they will have your config file and the compiler will use your config file instead of theirs unless you delete the one from the zip file. Anyone got any good ideas except for deleting the file when you download the object?

    Jeff has promised to support PATH declarations in an upcoming version of the IDE. This will solve the config file issue, because you can always prepend the directory name of your own config file ahead of the one where the unzipped archive lives. That way your own config file will automatically preempt the unzipped verison. I just hope there's a way to alter the PATH from the IDE without having to do it from a DOS command line or by changing a registry entry.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 6/22/2008 5:28:44 PM GMT
  • vampyrevampyre Posts: 146
    edited 2008-06-22 18:50
    OBC:
    Thanks for starting the page on the wiki

    If this is the way we are going to go, i'd like to see some example code that we can include in the standards definition for making use of the pindefs file, something we can post to get new users up and running quickly with it.

    also interesting to note, at the moment the winning choice on the poll is "data in the eeprom and on the card". its not winning by much, but if someone wants another option and hasn't voted, please do so
  • ColeyColey Posts: 1,110
    edited 2008-06-22 20:04
    OK Here is a binary that should work on Hybrid and Hydra.
    Obviously I have tested it on my Hybrid and it works fine, I would be grateful if someone with a Hydra can test it for me.
    If successful then I can adapt it for the demoboard too.

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite

    Post Edited (Coley) : 6/22/2008 10:38:19 PM GMT
  • ColeyColey Posts: 1,110
    edited 2008-06-23 00:03
    Here is another test app, I have now incorporated detection of the Parallax demo board.

    When run on Hybrid, Hydra or demo board it will display on the TV the name of the board and the clock speed.

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-06-23 00:15
    Works on my Protoboard.. Detected as Parallax Demoboard - 80Mhz

    Ok, spit it out.. How did you do it? [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange

    Post Edited (Oldbitcollector) : 6/23/2008 12:23:27 AM GMT
  • kuronekokuroneko Posts: 3,623
    edited 2008-06-23 00:40
    Coley said...
    ... I would be grateful if someone with a Hydra can test it for me.
    Confirmed working.
  • vampyrevampyre Posts: 146
    edited 2008-06-23 00:45
    you've peaked my curuiosity as well, will we get to see the sources?
  • ColeyColey Posts: 1,110
    edited 2008-06-23 08:00
    Hi, thanks for doing the binary tests for me

    The test is simplicity itself as you will see and I am sure it can be expanded upon to take additional hardware configurations.

    Basically it goes like this:-

    Start the Prop in RCSlow mode
    Change to RCFast and wait for PLL to warmup
    Check state of P12-P13 for harware configuration
    Set TV basepin and switch clock to a setting appropriate for the target board

    For Protoboards things may be a little difficult as I previously mentioned as there is no hardware predefined.

    Maybe the best way for Protoboard users is to match their hardware to one of the configurations in this code.

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
  • vampyrevampyre Posts: 146
    edited 2008-06-23 08:56
    Thats a very promising design, simple and clean. thanks for posting the code for it.
    I'm not sure this can be made to detect custom designs. if anyone can think of a way to mitigate that issue then were set.

    Right now as far as pins go, i'm still torn between using eeprom, and using the spin object include suggestion. the vote poll still has another 6 days so i guess i should just shut up and be patient [noparse]:D[/noparse]


    OBC:
    I have a question about the spin object include you've written up. I've noticed some -1 lines, i'm guessing thats to tell that the hardware isn't there? If so are we trying to create a list of all possible hardware? Wouldn't it make more since to simply omit an entry if that hardware isn't present? I cant immagine trying to keep everyones list up to date with all possible hardware.

    Example:
     'pindef
     
     'un-comment the code that matches your system, and change the pins where needed
    
        _clkmode  = xtal1 + pll16x
       _xinfreq  = 5_000_000
    
       ' Primary TV Connection Single
       TV_DAC1      = 12
    
        ' Primary Audio Connection Single
       AUDIO1       = 10
    
       ' Secondary Audio Connection
       'AUDIO2       = 11
    
      ' Primary Keyboard Single
        KEYBOARD1    = 26
    
    



    The above code would be a complete def file.

    Would there be a way for an application to test for 'missing' hardware in the list, other than a compile error?

    the other problem i see is that ever time someone adds a new peice of hardware, say, ROBOT_CAM to the list,
    they then have to convince everyone who's downloads their applications , and is using the file, to modify their
    files using the correct name

    it seems to me that just changing pin definitions in the con block would be easier.
    so my question is, have i missed something about how this could work? or are my assumptions basically correct?

    also, the word PAL_MODE is a bit confusing since you can use it to define NTSC. perhaps VIDEO_SIGNAL would be better?
  • BaggersBaggers Posts: 3,019
    edited 2008-06-23 08:57
    Coley, you might want to make it a seperate object, so it's easy to add to projects, and can then if any other mods get done to it, it's easy to replace stuff with it in [noparse]:D[/noparse]

    Baggers.

    Nice piece of code btw [noparse]:D[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-06-23 12:30
    I think we are missing some of the plot to a certain extent. For an OS to run it needs to know what basic hardware is installed and where it is installed. For instance you could have an OS that starts VGA, TV or serial depending on what was available. Most of us are also assuming that we need an sd card but it is possible to use an OS with just the eeprom (femtoBasic).

    So it seems to me that we really need to specify some minimum level of resources available and then make the os capable of finding out what/where this is either at compile time or run time. The advantage of compile time is that it is more likely to work if your board has some weird (non-standard) configuration and the binary should be slightly smaller. Doing it at run time means that you could release just the binary if you wanted to. For example, some of the drivers from the hydra book.

    So the spec would have three parts.
    1. Diagrams to say what was connected where on the hydra, hybrid and demoboards. - Easy to do just put a link the the schematic.
    2. An object to detect (at run time) which of the three boards is present and setup things properly. - Easy to do since Coley has already done it smile.gif
    -This can't really be the only option because too many people like experimenting with different things e.g. crystals.
    3. Another object that just lists a whole bunch of constants that people can change for their board. - OBC has done some good work on this.
    -May have to be careful with the number of constants. I think there is a limit (~256?)

    Of course the other issue is standard interfaces for input/output drivers. I think that this has basically happened but do we want to make a set of standard methods required?

    And shouldn't someone do a logo for things that are standards compliant? Who's good at ascii art?

    Edit: some of that didn't make sense. Hope everyone else can figure it out [noparse]:tounge:[/noparse]

    Edit2: If you edit your post quick enough it doesn't seem to add the edited at tag.

    Edit3: See, the second time I took too long and it added it.

    Post Edited (stevenmess2004) : 6/23/2008 12:35:53 PM GMT
  • ColeyColey Posts: 1,110
    edited 2008-06-23 13:32
    stevenmess2004 said...
    Doing it at run time means that you could release just the binary if you wanted to. For example, some of the drivers from the hydra book.

    I think the easiest thing from a binary release perspective is to state the platforms that the code will run on.
    This is what I will be doing in future with intermediate releases of any code I am writing.

    I don't quite understandthe rest of this thread though, what exactly are you aiming for???
    If the OS is already running to be able to read SD or EEPROM then surely pin definitions will already be set???
    Or is this that you want generic code to be able to run and self modify to use the correct pin defines??

    Defintions stored in EEPROM would be great but what about the demoboard it's only got 32K, what happens if your code uses all of it already?

    In my opinion when code is released it should state the minimum specification that the code requires and maybe a method within the code explaining where to change pin definitions.

    Otherwise you are going to struggle to cater for every eventuality which is gonna be nearly impossible!

    Just my two pence worth...

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
  • hippyhippy Posts: 1,981
    edited 2008-06-23 13:49
    I'm probably saying much as stevenmess2004 does, but here's my take on it: There are two parts to the subject -

    1) The pindefs constant file for the 'load source, compile, download, run' brigade who want to take source from others and run it with minimum fuss.

    2) Those pindefs being stored somewhere within the target platform so pre-compiled code can still work when copied to other hardware via SD cards etc.

    There's some overlap because (1) will be used when configuring the OS itself for a particular platform.

    For those working only from source code, 'compile time constants' are perfect, but for transportable code, programs need 'run-time determined constants' ( ie, the compile time constants used at OS compilation being retrievable at run time ).

    So Step 1 is defining the pindefs.spin file, constant names etc. Step 2 is defining a data structure which can hold those constants ( ie, the array name, where it is, how it's accessed ). Step 3 is getting people to use the Step 2 data structure rather than hard-coded in source values. In effect, Step 2 and 3 is moving to using a Windows Registry for Propeller programs.

    Step 1 is likely of interest to the entire Propeller community, Steps 2 and 3 probably only of interest to those who are looking at transportable programming directed at SD card.

    PS : The "edited" tag doesn't appear unless someone has read the post before a subsequent change is committed.
  • GiemmeGiemme Posts: 85
    edited 2008-06-23 13:59
    I think we should define a common layer, a kind of BIOS or Open Firmware so that an I/O card can be executed by any Propeller system that uses that BIOS (plug and play.

    Regards

    Gianni
  • JT CookJT Cook Posts: 487
    edited 2008-06-23 14:05
    That is pretty sweet, I am going to have to check that out and try to implement that into my programs. Nice job Coley!!
  • simonlsimonl Posts: 866
    edited 2008-06-23 14:24
    I vote that we work from Hippy's last reply - it appears to cover the bases for all smile.gif

    So, I think we need to get the following sorted first:

    1. Standard pindefs.spin
    2. Documentation on how to use it (that'll be within pindefs.spin then!)

    Probably best if someone posts a first draft, then we can provide input from there... (I'd do it, but I don't know how!)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-06-23 14:29
    simonl said...
    I vote that we work from Hippy's last reply - it appears to cover the bases for all smile.gif

    Probably best if someone posts a first draft, then we can provide input from there... (I'd do it, but I don't know how!)

    It's posted... hack away..

    Needs some standards for various clock chips instead of just the 1307
    and some generic standards for SPI connections.

    propeller.wikispaces.com/PinDefs.spin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange
  • simonlsimonl Posts: 866
    edited 2008-06-23 14:36
    Gees OBC - far too quick! (LOL) Nice work smile.gif

    So we have step 1 - now for step 2...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif
  • hippyhippy Posts: 1,981
    edited 2008-06-23 15:29
    I think we have enough of the concept grasped to be able to move forward but there is still some high-level debate to be had ...

    Q : What happens if someone's code uses new device and new I/O lines ?

    For the source-compilers the missing pin names will be obvious and can be added to pinsdef.spin, but how does that work for people with a pre-compiled platform which doesn't know those pins ?

    Assuming the OS database is fundamentally an array or list of pin definitions, how do we relate a pin name for runtime use into an index into that array, how do we stop / help avoid two developers using the same array index for different things ?

    Do we have a standard list of indexes of where a particular pin will be, necessitating a central repository and hoping everyone plays ball with that process, or go for a more complicated but flexible scheme where the database can be looked up by pin name ?

    I think getting that right is going to be crucial to success and adoption. Text names add unnecessary bloat ( and again we hit a PropTool limitation of not supporting packed text ), but then a straight array having to support numerous pins, most unused adds bloat as well. Sparse arrays save space but have overhead.

    Does there need to be a mechanism for extending the pindefs array/list so OS users can add a new pin definition without having to re-compile their OS every time a new program comes out which uses a new device or I/O pin ?

    Then comes the harder sell - Should everyone writing for the Propeller be using this mechanism even though they are compile-source-only developers ? There's little runtime overhead, "tvPin := pd.PinLookup(String("TV_ADC1"))" at the start of PUB Main rather than a constant definition but will developers suck up the need to include a pindefs object and the overhead it comes with ?

    What of the existing Parallax Objects, like TV_text, should they be changed to use pindefs ? How do we achieve consistency across the board ?

    Added : Should we also be looking at something beyond just pin allocation, something which is more akin to the Windows Registry so things like IP addresses, 'This Unit ID', colour choices and keyboard mappings can be determined ? Can it be used for user preferences - mouse / keyboard / NES gameplay, high-score tables ?

    Post Edited (hippy) : 6/23/2008 3:39:46 PM GMT
  • BaggersBaggers Posts: 3,019
    edited 2008-06-23 17:02
    Quick question!, What about people who don't use SD, like current Hydra users, how will they get their pindefs? or are you just leaving them out of the situation?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
Sign In or Register to comment.