Shop OBEX P1 Docs P2 Docs Learn Events
Porting Arduinio 3D Printer code (Teacup firmware) into a Propeller - Page 2 — Parallax Forums

Porting Arduinio 3D Printer code (Teacup firmware) into a Propeller

2456789

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-09 10:58
    Rather dim of me, I can just go to GITHUP and get another zip.

    Here it is, but it may not be the same as a .zip from the link I mentioned previously as it seems there is more than one GITHUP site with Teacup Firmware (maybe a mirror site). This zip blow is from the site that the originator maintains... seems best.


    Teacup in this zip is from https://github.com/Traumflug/Teacup_Firmware


    I also included a zip of Tonokip for future possibilities. No change in previously mentioned Github link.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-09 12:06
    I played around a little with the project and got the list of errors below.

    My project adds -DMOTHERBOARD=PropellerASC which is not defined yet although a copy of pins are set in the pins.h file. The configuration.h file adds #define MOTHERBOARD, so that is commented out for the moment.

    I also had to move setup() and loop() to the end of the Tonokip_Firmware.c file.

    The Serial object in libArduino needs to be completed. Several items are "not declared in scope" ... they seem to be function names that are declared as "inline" before being used. This must be an arduino thing. There are also some declarations that don't mean anything at all - probably another arduino thing.

    People use Arduino to teach C programming in colleges? Bet the students get strange looks in job interviews (and zero call-backs).

    The SimpleIDE project is attached.
    Project Directory: C:/gccdev/spinside/testcode/Tonokip-Firmware-master/Tonokip_Firmware/
    
    
    propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc-alpha_v1_9_0_2408)
    propeller-elf-c++ -I . -L . -I C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino -L C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/cmm/ -o cmm/Tonokip_Firmware.elf -Os -mcmm -Wall -m32bit-doubles -fno-exceptions -fno-rtti -DMOTHERBOARD=PropellerASC Tonokip_Firmware.c -lArduino
    In file included from Tonokip_Firmware.c:6:0:
    pins.h:5:2: warning: #warning "PropellerASC not defined yet" [-Wcpp]
    Tonokip_Firmware.c: In function 'void get_command()':
    Tonokip_Firmware.c:68:14: error: 'class Serial_' has no member named 'available'
    Tonokip_Firmware.c:69:26: error: 'class Serial_' has no member named 'read'
    Tonokip_Firmware.c:74:14: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:77:24: error: 'process_commands' was not declared in this scope
    Tonokip_Firmware.c: In function 'void process_commands()':
    Tonokip_Firmware.c:115:14: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:116:33: error: invalid conversion from 'long int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:117:32: error: 'FlushSerialRequestResend' was not declared in this scope
    Tonokip_Firmware.c:128:16: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:129:35: error: invalid conversion from 'long int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:130:34: error: 'FlushSerialRequestResend' was not declared in this scope
    Tonokip_Firmware.c:137:14: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:138:33: error: invalid conversion from 'long int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:139:32: error: 'FlushSerialRequestResend' was not declared in this scope
    Tonokip_Firmware.c:150:14: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:151:33: error: invalid conversion from 'long int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:164:25: error: 'get_coordinates' was not declared in this scope
    Tonokip_Firmware.c:186:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:186:72: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:186:72: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:187:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:187:64: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:187:64: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:188:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:188:76: error: invalid conversion from 'long unsigned int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:189:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:189:75: error: no matching function for call to 'Serial_::println(float)'
    Tonokip_Firmware.c:189:75: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:190:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:190:66: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:190:66: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:192:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:192:72: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:192:72: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:193:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:193:64: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:193:64: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:194:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:194:76: error: invalid conversion from 'long unsigned int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:195:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:195:75: error: no matching function for call to 'Serial_::println(float)'
    Tonokip_Firmware.c:195:75: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:196:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:196:66: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:196:66: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:198:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:198:72: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:198:72: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:199:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:199:64: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:199:64: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:200:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:200:76: error: invalid conversion from 'long unsigned int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:201:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:201:75: error: no matching function for call to 'Serial_::println(float)'
    Tonokip_Firmware.c:201:75: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:202:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:202:66: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:202:66: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:204:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:204:72: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:204:72: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:205:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:205:64: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:205:64: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:206:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:206:76: error: invalid conversion from 'long unsigned int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Tonokip_Firmware.c:207:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:207:75: error: no matching function for call to 'Serial_::println(float)'
    Tonokip_Firmware.c:207:75: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:208:18: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:208:66: error: no matching function for call to 'Serial_::println(float&)'
    Tonokip_Firmware.c:208:66: note: candidate is:
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note: void Serial_::println(const char*)
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: note:   no known conversion for argument 1 from 'float' to 'const char*'
    Tonokip_Firmware.c:212:87: error: 'linear_move' was not declared in this scope
    Tonokip_Firmware.c:213:21: error: 'ClearToSend' was not declared in this scope
    Tonokip_Firmware.c:220:77: error: 'manage_heater' was not declared in this scope
    Tonokip_Firmware.c:244:66: error: 'temp2analog' was not declared in this scope
    Tonokip_Firmware.c:247:16: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:248:59: error: 'analog2temp' was not declared in this scope
    Tonokip_Firmware.c:252:66: error: 'temp2analog' was not declared in this scope
    Tonokip_Firmware.c:257:20: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:261:25: error: 'manage_heater' was not declared in this scope
    Tonokip_Firmware.c:277:19: error: 'disable_x' was not declared in this scope
    Tonokip_Firmware.c:278:19: error: 'disable_y' was not declared in this scope
    Tonokip_Firmware.c:279:19: error: 'disable_z' was not declared in this scope
    Tonokip_Firmware.c:280:19: error: 'disable_e' was not declared in this scope
    Tonokip_Firmware.c:287:85: error: 'kill' was not declared in this scope
    Tonokip_Firmware.c:288:85: error: 'kill' was not declared in this scope
    Tonokip_Firmware.c:300:15: error: 'ClearToSend' was not declared in this scope
    Tonokip_Firmware.c: In function 'void FlushSerialRequestResend()':
    Tonokip_Firmware.c:306:38: error: 'ltoa' was not declared in this scope
    Tonokip_Firmware.c:307:10: error: 'class Serial_' has no member named 'flush'
    Tonokip_Firmware.c:309:15: error: 'ClearToSend' was not declared in this scope
    Tonokip_Firmware.c: In function 'void linear_move(long unsigned int, long unsigned int, long unsigned int, long unsigned int)':
    Tonokip_Firmware.c:372:34: error: 'enable_x' was not declared in this scope
    Tonokip_Firmware.c:373:34: error: 'enable_y' was not declared in this scope
    Tonokip_Firmware.c:374:34: error: 'enable_z' was not declared in this scope
    Tonokip_Firmware.c:375:34: error: 'enable_e' was not declared in this scope
    Tonokip_Firmware.c:387:67: error: 'do_x_step' was not declared in this scope
    Tonokip_Firmware.c:392:67: error: 'do_y_step' was not declared in this scope
    Tonokip_Firmware.c:397:67: error: 'do_z_step' was not declared in this scope
    Tonokip_Firmware.c:401:87: error: 'do_e_step' was not declared in this scope
    Tonokip_Firmware.c:404:21: error: 'manage_heater' was not declared in this scope
    Tonokip_Firmware.c:407:26: error: 'manage_inactivity' was not declared in this scope
    Tonokip_Firmware.c:411:27: error: 'disable_x' was not declared in this scope
    Tonokip_Firmware.c:412:27: error: 'disable_y' was not declared in this scope
    Tonokip_Firmware.c:413:27: error: 'disable_z' was not declared in this scope
    Tonokip_Firmware.c:414:27: error: 'disable_e' was not declared in this scope
    Tonokip_Firmware.c: In function 'void kill(byte)':
    Tonokip_Firmware.c:541:12: warning: statement is a reference, not call, to function 'disable_x' [-Waddress]
    Tonokip_Firmware.c:541:12: warning: statement has no effect [-Wunused-value]
    Tonokip_Firmware.c:542:12: warning: statement is a reference, not call, to function 'disable_y' [-Waddress]
    Tonokip_Firmware.c:542:12: warning: statement has no effect [-Wunused-value]
    Tonokip_Firmware.c:543:12: warning: statement is a reference, not call, to function 'disable_z' [-Waddress]
    Tonokip_Firmware.c:543:12: warning: statement has no effect [-Wunused-value]
    Tonokip_Firmware.c:544:12: warning: statement is a reference, not call, to function 'disable_e' [-Waddress]
    Tonokip_Firmware.c:544:12: warning: statement has no effect [-Wunused-value]
    Tonokip_Firmware.c:552:22: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:553:22: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:554:22: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:555:22: error: 'class Serial_' has no member named 'print'
    Tonokip_Firmware.c:557:31: error: invalid conversion from 'long int' to 'const char*' [-fpermissive]
    C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/Serial.h:17:8: error:   initializing argument 1 of 'void Serial_::println(const char*)' [-fpermissive]
    Done. Build Failed!
    
    
    Click error or warning messages above to debug.
    
    
    
  • Martin_HMartin_H Posts: 4,051
    edited 2014-04-09 13:23
    First off this is progress. Compilation errors mean you have the code compiling under the new tool chain.

    @Loopy, remember above when I said serial and I2C were the weakest part of the library? That's because the Arduino has a ton of Serial functions to print every possible data type and I only implemented one of them. They won't be that hard to add, so I can use these warnings as a to do list. What I can do at first is just create stubs just to let things compile.

    @Jazzed, I downloaded your library and as you said you had to rename it libArduino, but the code is otherwise the same. I can see about pushing that up to my code repository this weekend. Tonight and tomorrow night I won't have the time, although I might have time on Friday.

    The Arduino guys do many strange things. One is declaring a class then creating an instance of that class in the global namespace. They could have just used static functions and data members like the Pololu guys did with their library.
  • Martin_HMartin_H Posts: 4,051
    edited 2014-04-09 19:14
    I pushed a new Serial.h and Serial.cpp to my Git repo that contains stubs for the unimplemented serial functions. So if you fetch them some of the build errors will go away. I will see about implementing them shortly.

    @Jazzed, I tried the rename suggestion and it broke the compilation of my unit tests. So I'll hold off that until I understand it better. Things that are too Simple confuse me.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-09 22:01
    Hi.

    Ok. One thing that is needed is an ltoa.c function which is not standard C. I lifted a copy from this public domain file, and dropped it into the arduino source with a forward declaration in Arduino.h.

    Also added some forward references to functions before setup().
    void get_command();
    void code_search(char code);
    float code_value();
    long code_value_long();
    bool code_seen(char code_string[]);
    bool code_seen(char code);
    void process_commands();
    void FlushSerialRequestResend();
    void ClearToSend();
    void get_coordinates();
    void do_x_step();
    void do_y_step();
    void do_z_step();
    void do_e_step();
    void disable_x();
    void disable_y();
    void disable_z();
    void disable_e();
    void  enable_x();
    void  enable_y();
    void  enable_z();
    void  enable_e();
    void manage_heater();
    void kill(byte debug);
    void manage_inactivity(byte debug);
    void linear_move(unsigned long x_steps_remaining, unsigned long y_steps_remaining, unsigned long z_steps_remaining, unsigned long e_steps_remaining);
    float temp2analog(int celsius);
    float analog2temp(int raw);
    


    Had to add stubs for millis() and micros() in wiring.h.

    Now I get the output below with total code size at around 19KB in CMM mode.
    Project Directory: C:/gccdev/spinside/testcode/Tonokip-Firmware-master/Tonokip_Firmware/
    
    
    propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc-alpha_v1_9_0_2408)
    propeller-elf-c++ -I . -L . -I C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino -L C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/libArduino/cmm/ -o cmm/Tonokip_Firmware.elf -Os -mcmm -Wall -m32bit-doubles -fno-exceptions -fno-rtti -DMOTHERBOARD=PropellerASC -fpermissive Tonokip_Firmware.c -lArduino
    In file included from Tonokip_Firmware.c:6:0:
    pins.h:5:2: warning: #warning "PropellerASC not defined yet" [-Wcpp]
    Tonokip_Firmware.c: In function 'void kill(byte)':
    Tonokip_Firmware.c:611:12: warning: statement is a reference, not call, to function 'disable_x' [-Waddress]
    Tonokip_Firmware.c:611:12: warning: statement has no effect [-Wunused-value]
    Tonokip_Firmware.c:612:12: warning: statement is a reference, not call, to function 'disable_y' [-Waddress]
    Tonokip_Firmware.c:612:12: warning: statement has no effect [-Wunused-value]
    Tonokip_Firmware.c:613:12: warning: statement is a reference, not call, to function 'disable_z' [-Waddress]
    Tonokip_Firmware.c:613:12: warning: statement has no effect [-Wunused-value]
    Tonokip_Firmware.c:614:12: warning: statement is a reference, not call, to function 'disable_e' [-Waddress]
    Tonokip_Firmware.c:614:12: warning: statement has no effect [-Wunused-value]
    propeller-load -s cmm/Tonokip_Firmware.elf
    propeller-elf-objdump -h cmm/Tonokip_Firmware.elf
    Done. Build Succeeded!
    
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-10 05:51
    Hello all,
    Build succeed! Regardless of the errors that is very very good news.

    I am very happy to see you have shifted over to working with Tonokit as Teacup is far more ambious and complex ( a lot more topics to learn and problems to resolve.. a long slow slog). If any of us slow learners are going to be able to learn porting Arduino to Propeller for 3D printers, starting with the Tonoikit files is excellent.

    Having said that, Tonokit is in the Abandoned and Depreciated RepRap firmware for good reasons. It simply doesn't provide a complete set of g-codes that Teacup targeted g-code expects.

    SO after it is gotten to run, it will require enhancement.

    But I am all for progress rather than perfection. And I am all for having a project that even the newest of Propeller users can follow along and arrive at a good destination.

    So, we will focus on Tonokit for now... Teacup may come later, and that may be much later at the rate I learn.

    +++++++++
    What am I going to do at this point?


    REREAD and study this whole thread of postings. It is obvious that I didn't not understand some good advice from Martin H and Jazzed as I was struggling with other issues that seemed at the fore-front.

    Tonokit code is easy for me to understand; whereas, Teacup is massively complex. I actually spent some time this afternoon enjoying reading the Tonokit code and comparing against what I know that Slic#3r supplies for Teacup code.

    +==========
    In sum, I need to revisit the use of SimpleIDe with libPropelleruino to see if I can get something similar to what Jazzed as generated in error codes. I am not their yet... still stubling along.

    Nonetheless, I am happy with the progress and will respond to specifics as I catch up, or at least try to catch up.

    Thanks again for helping out. The past few days it seemed like I should give up. But I am over that.

    To anybody that is new to all this... Please be patient. Jazzed and Martin H. are enhancing libPropelleruino in parallel to me learning how to use it.
  • Martin_HMartin_H Posts: 4,051
    edited 2014-04-10 06:02
    @jazzed, in the Arduino platform the Serial class uses the underlying HardwareSerial which uses the UART. This allows non-blocking I/O and implements the available function. In Spin the ParallaxSerialTerninal class does a good job of emulating a UART including detecting if characters are available in the buffer.

    How do the C I/O functions of printf and getchar work with Propgcc? Do they block and bit bang the I/O in the current cog, or is there a cog simulating a UART? If they are blocking then I'll need to dedicate a cog for serial I/O.

    The millis and micros functions should be quick as there are already version on the Propeller in Spin. They usually need to solve the rollover problem because the built in counter wraps every minute or so.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-10 06:47
    Martin_H wrote: »
    @jazzed, in the Arduino platform the Serial class uses the underlying HardwareSerial which uses the UART. This allows non-blocking I/O and implements the available function. In Spin the ParallaxSerialTerninal class does a good job of emulating a UART including detecting if characters are available in the buffer.

    Noticed that last night poking around the 1.5.x code. The Serial class is used like it is static, but I don't see any static declarations - is this another arduino hack?
    Martin_H wrote: »
    How do the C I/O functions of printf and getchar work with Propgcc? Do they block and bit bang the I/O in the current cog, or is there a cog simulating a UART? If they are blocking then I'll need to dedicate a cog for serial I/O.

    Depends as it can be either FullDuplexSerial or SimpleSerial. Honestly though, propeller-gcc printf() is too big, and simpletext.h should be used instead with small functions like putChar() and putDec(), and maybe print() which does float but costs 5KB (putFloat() might be cheaper). I'm guessing that we have to setup the port in main() presuming that Serial is just the debug port.
    Martin_H wrote: »
    The millis and micros functions should be quick as there are already version on the Propeller in Spin. They usually need to solve the rollover problem because the built in counter wraps every minute or so.

    Hmm. micros() "Returns the number of microseconds since the Arduino board began running the current program." I presume that the main would read and save the CNT state, and mills()/micros() would read that. A COG could be used over time to store results in microsec, millisec, seconds, and even minutes variables.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-10 06:52
    Hello all,
    Build succeed! Regardless of the errors that is very very good news.

    Ya, just need to fix up some things like Martin mentioned. Also need to define a board pins configuration for a test subject. The warnings are interesting and could be problems, but they are not errors otherwise the build would have failed.
    I am very happy to see you have shifted over to working with Tonokit as Teacup is far more ambious and complex ( a lot more topics to learn and problems to resolve.. a long slow slog). If any of us slow learners are going to be able to learn porting Arduino to Propeller for 3D printers, starting with the Tonoikit files is excellent.

    Ya, a smaller bite is easier to swallow. One thing at a time.
  • Martin_HMartin_H Posts: 4,051
    edited 2014-04-10 07:17
    jazzed wrote: »
    Noticed that last night poking around the 1.5.x code. The Serial class is used like it is static, but I don't see any static declarations - is this another arduino hack?

    Yes, the header defines a class called Serial_ and an extern for an instance called Serial. The cpp file then implements Serial_ and declares the storage for the Serial instance in the global scope. I think they did that to allow for the dot notation rather than the Class::method notation for calling statics. It makes C++ look more like the Java used in the Processing project, but it's bad form for C++.

    jazzed wrote: »
    Depends as it can be either FullDuplexSerial or SimpleSerial. Honestly though, propeller-gcc printf() is too big, and simpletext.h should be used instead with small functions like putChar() and putDec(), and maybe print() which does float but costs 5KB (putFloat() might be cheaper). I'm guessing that we have to setup the port in main() presuming that Serial is just the debug port.

    For the most part Serial is used like PBasic's DEBUG command, and being synchronous isn't a problem. But for a CNC machine people use the ability to receive gcode input while the MCU is doing other things. As long as the main loop polls available before the 64 character buffer fills up life is good. So we'll need a similar ability here.
    jazzed wrote: »
    Hmm. micros() "Returns the number of microseconds since the Arduino board began running the current program." I presume that the main would read and save the CNT state, and mills()/micros() would read that. A COG could be used over time to store results in microsec, millisec, seconds, and even minutes variables.

    I already use a cog for pulsing servo in the background, I planned on adding this function as well, so I can do it without consuming another cog.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-10 07:30
    Martin_H wrote: »
    For the most part Serial is used like PBasic's DEBUG command, and being synchronous isn't a problem. But for a CNC machine people use the ability to receive gcode input while the MCU is doing other things. As long as the main loop polls available before the 64 character buffer fills up life is good. So we'll need a similar ability here.

    The Simple Library fdserial should be used for this. The PASM is a bit bigger than I would like (Parallax Serial Terminal.spin). It has a 64 byte fifo though and can be increased if necessary in the source. It would take less than an hour to write this code ... although testing is always more complicated ;-).
    Martin_H wrote: »
    I already use a cog for pulsing servo in the background, I planned on adding this function as well, so I can do it without consuming another cog.

    Most excellent!

    Of course we need to worry about ADCs. The MGH PropellerASC (10 in stock) has an 8 port ADC (MCP3208) on it. That's a good target board. The Propeller ActivityBoard also has an ADC with 4 channels on it. Neither one is 5V tolerant. Not sure if that's an issue or not.
  • Martin_HMartin_H Posts: 4,051
    edited 2014-04-10 07:43
    The existing code already supports the ADC on the PropellerASC, so we're good to go with that.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-10 08:26
    Martin_H wrote: »
    The existing code already supports the ADC on the PropellerASC, so we're good to go with that.

    Great. Thanks.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-10 09:06
    Martin_H wrote: »
    @Loopy, I figure that I'll help you, but this is your project, so you're the boss. I read the firmware so I can give advice rooted in some knowledge. I imagine that the SD card front end could be added fairly easily. In fact I bet you could mix and match that portion of the project.

    How I port software to a new platform is to pull all the modules into the new platform's build tools and let it rip. I then see a whole truckload of errors for missing functions or types. Hurry for progress! I then pick one function at a time and create do nothing stubs until it compiles clean. Hurry for more progress! Phase two is providing implementations for the stubs in the order that they are called. Often the rule of 80/20 kicks in and a small number of functions gets a system working well enough to do something useful.

    I also like to defer decisions for as long as possible. For example in getting a clean compile I wouldn't care how I'll implement the functions in phase 2. That's a distraction that will slow down the goal of a clean build. I also try to change the source software as little as possible. The more changes you make the more debugging formerly working code you will do.

    You'll learn a ton by porting software for both the source platform and the new target. You can also see how other people solve system organization problems in both good and bad ways.

    The above entry by Martin H. is very useful and important. Worth repeating at this point as a general strategy. I certainly needed a Review of I as was distracted when the original was posted.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-10 09:08
    jazzed wrote: »
    @Loopy,

    Remember that a 30KB AVR program is an 8-bit program that runs on a C optimized instruction set. So, there is probably no way a 30KB AVR program will compile to 30KB on Propeller. It would be very interesting if it turns out to be smaller.

    I wrote a G-Code interpreter in SPIN once for a CNC mill. I had room to do basic commands in the end, but finishing the interpreter would have taken much more effort. Here is a video of the Propeller G-Code interpreter running the X-Y table.

    Video link appears to be PRIVATE!
  • jazzedjazzed Posts: 11,803
    edited 2014-04-10 09:15
    Video link appears to be PRIVATE!

    Youtube has changed some things over the years. One of them appears to be that videos now need to be published. No idea why things aren't grandfathered there. I've published the video, again! ;-)
  • Brian_BBrian_B Posts: 842
    edited 2014-04-10 19:25
    Does the RAMPS driver board work with the propellerASC ?

    Brian
  • idbruceidbruce Posts: 6,197
    edited 2014-04-11 00:06
    @Jazzed, Martin_H, and Loopy

    It sounds as though you guys are making some serious progress on this project. I truly believe that your efforts will be of benefit to Parallax and the Propeller chip, as well as by others that may need such code for their Propeller projects. If 3D printing turns out to be the next BIG thing as they predict, 3D printing firmware for the Propeller could possibly lead to sales.

    I wish I could try and jump in at this point, but I have not even poked around the SimpleIDE yet, plus I already have my hands full.

    I guess I just wanted to say that I think you guys are doing wonderful things for Parallax, the Propeller chip, the Propeller community, and CNC developers. Keep up the good work guys.

    Bruce
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-11 03:36
    Brian_B wrote: »
    Does the RAMPS driver board work with the propellerASC ?

    Brian

    Seems like a very valid question.
    But Martin H. is not the other Martin, Martin Hodge whom is the originator of the PropellerASC. There is a thread that started on 2010 and is still active about the PropellerASC.

    I like the idea of using the RAMPS to save on build time. It is a little early is the porting to promise pin for pin compatiblity, but I suspect it won't be hard to DIY an i/o configuration if necessary.

    http://forums.parallax.com/showthread.php/124288-Propeller-ASC-(Arduino-Shield-Compatible)

    It seems that the lastest edition is actually the PropellerASC+ (note the plus).
    But, it does seem to me that the ArduinioMega is a different i/o configuration that the ArduinoUNO. More i/o pins and so on.
    So it might be that another generation of the PropellerASC+ that is specific to the Mega i/o might be what you require.... ask Martin Hodge if he has plans for such.

    http://mghdesigns.com/propeller/mgh-designs/propeller-asc-arduino-shield-compatible-1.html

    http://reprap.org/wiki/Arduino_Mega_Pololu_Shield

    http://arduino.cc/en/Main/ArduinoBoardMega
  • Brian_BBrian_B Posts: 842
    edited 2014-04-11 04:56
    @loopy,
    Ramps is very nice to work with , and they make some really souped up stepper drivers for that board (and they are replaceable if you let the magic smoke out).

    Here is a uno driver board ,but not really enough drivers for a fully operational 3d printer.

    https://www.inventables.com/technologies/gshield

    Brian
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-11 06:31
    @Brian_B
    I do understand the dilemma, the RAMPS board was built with all the features, and nicely modlar to support 3D printing; while the UNO shield was created for an XYZ project without the 4th stepper to feed material.
    The GRBL firmware that supports the smaller board may soon become another Arduino port. The original code fits an ArduinoUNO.

    This thread is primarily about porting the firmward, and NOT about what kind of shields and boards a 3D Propeller Firmwater will eventually accomodate.
    It is just too soon to be worrying about hardware. And while Pololu really does a good job with stepper motors, stepper motor controllers, and the RAMPS; there are other options as well.

    You have to realize that Propeller i/o is quite flexible.. just about any i/o pin can be assigned or swapped. They only areas where limitations might come in are with video generation as you need a serial of contiguous i/o for that.

    In sum, the show and tell of hardware is informative, but the discussion herein is realy about creating firmware. That's the goal. It gets crazy if eveyone starts making requests for more code for their favorite hardware.
  • Brian_BBrian_B Posts: 842
    edited 2014-04-11 07:17
    Loopy,
    I thought some insight on real working hardware would be useful (and why it works and don't work). I'll mind my own business for now on.

    Brian
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-11 08:43
    @Brian_B
    Well, I didn't mean for my comment to be taken so hard.
    In fact, I did some reasearch and even left a posting for Martin Hodge that mentioned the need for a PropellerASC version that would support ArduinoMega pinouts.
    I just look at it all as first things first.

    What is my concern?
    It is just that this could become a rather lengthy thread about requesting support for all sorts of Arduinio shields.
    I am not in a position to manufacture Propeller boards to support all the Arduino shields on the Propeller.
    At the beginning of the thread, I clearly stated that I was primarilty interested in porting software functionality and not the Wiring side of Arduino.

    I just want to learn how use Arduino projects on a Propeller. In truth, I am not very interested in 3D printing, more interested in CNC in general.
    Learning how to port more ambitious Arduino code will obviously encourage someone to build Propeller boards that support Arduinio shields of all kinds.
    (Actually most of the simpler Arduino shields for the UNO are supported via the PropellerASC+, but the libPropelluino code may need more library expansion)

    But there also may actually come a point where some Arduino projects will require the Propeller2 in order to port.. more RAM, more i/o, and more ADC included.

    First things first means one might have to crawl, then walk, and finally can run.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-11 09:58
    @Loopy,

    We need to define some kind of a pin configuration for testing. I have an X-Y table with steppers attached to a Propeller Protoboard already (from the video), so I'll make a configuration for that. I imagine that there may be other useful configurations. Such things can be selectable at build time (or even load time for SimpleIDE board types as long as just the pins can be different and the stepper protocol is the same).

    Stepper motors may be too slow for big projects. But that a bridge far away at this point.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-11 11:08
    @Jazzed
    If it works for you, just use what the ArduinoUNO and the PropellerASC+ conform to. I just want a small working 3D printer firmware on the Propeller1. If there is a Propeller 3D firmware following, these things will get resolved by other participants.

    I am more concerned with overcoming any code weaknesses in Tonokip that Teacup may have resolved. But a working Tonokip-as-is seems to be a necessary milestone.

    It seems that each of the X, Y, and Z stepper motors require 5 pins
    1. Enable
    2. Direction
    3. Step
    4. A stop switch sensor at one extreme
    5. A stop swithc sensor at the other extreme.

    So for just X and Y, all you might require is 10 i/o and no ADC functionality

    When we get into 3D printers we need a 4th stepper for feed of material
    But that requires on 3 pins as there are not stop extremes.

    Plus more pins for ADC inputs and heater control.

    Just reading of the list in Tonokip offers more items, such as maybe a kill switch (handy) and I really not sure what else (maybe a fan).

    For your testing, and if you indeed do have a PropellerASC+, you might want the board that Brian_B first linked to. It is a $49.00 USD cost and though the link says "NOT AVAILABLE", there is a comment that provides another link to where you can buy immediately.

    As it stands, this is the only shield for the ArduinoUNO format of pinout that is currently available. I don't know if there is a true 3D printer shield for the ArduinoUNO pinout or if everyone has gone over the ArduinoMega format.

    So here I am talking hardware again. Personally, I had in mind using a package of Chinese XYZ stepper motor controllers (for more power, like a 4amp 24 volt setup) and just cabling from the Propeller ProtoBoard to the stepper motor controllers.

    When you build a cable, it can overcome all sorts of pinout configurations, but Arduino uses these stacked boards. Stacked boards as adapters are more costly and lock you into using only Arduino compatible products SO pin sequence is marketing tool.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-11 11:59
    Ok,

    Here is a SimpleIDE package with "a Serial solution" in it. I've run things like the Arduino AsciiTable program with it. Haven't really tested Serial.available() and Serial.peek() functions yet.

    Extract the .zip and open tonokip.side. Choose a propeller serial port. Open and set the SimpleIDE terminal to 19200 baud. Then click the "Run with Terminal" toolbar button.

    @Loopy

    I only have an LCD Arduino shield and have never used that, but I plan to someday.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-12 03:37
    MILESTONE -- We seem to have a port of Tonokit that can be bench tested with an actual 3D printer.
    (BTW- I don't have one, Jazzed doesn't have one. Anyone want to try and report back?)

    @Jazzed
    Tonokip's .zip has only three files -- the main body of code, a configuration file, and a pins file.

    I am trying to bring onboard the timid and new inexperienced user, that have yet to learn to read and modify big code projects.

    So that is why I keep trying to assert to stick with Tonokit's original code and configuration until it gets working. Teacup is rather larger with about 99 files to sift through and even a make file.. it needs to be pruned down by elimination of all the conditional code for other platforms before it might be sensible to me.

    I think Teacup may do linear interpolation and curve interpolation, whereas Tonokip does not.
    And I think Teacup may also manage accelleration and decelleration, whereas Tonokip does not.
    ( NOTE -- Accelleration and decelleartion seem to be a 3-D thermal printhead requirement that CNC may not require).

    The problem here is that 'Feature Rich' code is daunting to the new learner and I am trying to nuture rather than chase away people that want to get started.

    There are indeed short-comings with Tonokit.

    Right out of the gate, it may have to be adapted to use additional F codes to accept Teacup targeted g-codes. (Or it might be that F codes can simply be trapped and ignored, but I am wary.)

    ++++++++++++++++++
    And, since your demo bench is likely is more compatible with Gerber targeted g-code, which is entirely 2-D.. but more sophisticated for 2-D printed circuits -- I fear that you might be feeding wrong g-code compiles into Tonokip firmware for our 3-D printer goal.

    At this point, feeding Slic3R g-code files for bench test would be optimal. I think I can include one herein.example012.gcode.txt

    This simply took a OpenSCAD 3-D example (Example 12, arbitrarily chose) and fed it into Slic3r to generate Teacup acceptable G-code.

    It includes all the g-code for dimensions and the print head.

    You might strip it to work with only your X-Y dimensions. But it is informative on what is and what is not included in the Tonokit parser.

    The actual object it is supposed to print is cubic shape with holes in it, so coding for curves may just have been avoided in the compile stage. I will try to get another example that has more demanding surface shapes to see if more G-codes pop up.

    The end of the file may have some codes important to shutting down the 3-D printer. (I seem to recall that Linux has two utilities ... Header and Footer that allow you to get a quick look at .txt files for what is at the beginning and end... without having to 'mouse around' and scroll up and down.
    The whole solution is layered. So where you see G92, a new layer is about to begin. The first few hundred lines of the the file is most informative.

    I believe both Tonokit and Teacup start printing automatically.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-12 04:58
    Hello All,
    I am providing a spherical g-code example from OpenSCAD that was compiled at a 43mm sphere in Slic3r. This might offer better clarity into how Teacup handles curved surfaces and round holes (the sphere has 4 holes in it)

    So it seems that even with curved surfaces, G1 is used for the build, not G2 or G3.

    But there is an F code that Tonokit doesn't recognize (until we create a modified Tonokit that is fully compatible with all Teacup codes)

    Unsure about M codes and such. I need to reconcile what is in the provide Tonokip agains what Slic3r creates. Maybe later today I will have a summary of omissions.
  • Brian_BBrian_B Posts: 842
    edited 2014-04-12 05:08
    My pin suggestions,

    1- x step
    1- x dir
    1- x home

    1- y step
    1- y dir
    1- y home

    1- z step
    1- z dir
    1- z home

    1- a step (extruder)
    1- a dir (extruder)

    1- x,y,z,a enable
    1 -x,y,z overlimit (this is optional)

    1- pwm extruder heater
    1- adc extruder thermoresistor

    *** optional *****
    1- pwm bed heater (for abs plastic)
    1- adc bed thermoresistor
    1- pwm cooling fan
    1- Estop


    Brian
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-12 05:26
    @Brian_B

    It seems we agree. That is nearly equivalent to the pins.h file in Tonokit's zip file.
    The variation is in the use of the optional pins.

    Here is an excerpt where -1 indicates NO in use, but has code support. This all seems close enough to be easy to modify and make work. And don't overlook that fact that Propelller seems to have some empty pins remaining as the 28 pin AVR328 is being ported to a 40 pin Propeller. ADC pins on the Propeller take a 2 pin interface to provide 8 ADC inputs, a new gain of 7 inputs.

    =++++++++++++++++++++++++++
    #define X_STEP_PIN 2
    #define X_DIR_PIN 3
    #define X_ENABLE_PIN -1
    #define X_MIN_PIN 4
    #define X_MAX_PIN 9

    #define Y_STEP_PIN 10
    #define Y_DIR_PIN 7
    #define Y_ENABLE_PIN -1
    #define Y_MIN_PIN 8
    #define Y_MAX_PIN 13

    #define Z_STEP_PIN 19
    #define Z_DIR_PIN 18
    #define Z_ENABLE_PIN 5
    #define Z_MIN_PIN 17
    #define Z_MAX_PIN 16

    #define E_STEP_PIN 11
    #define E_DIR_PIN 12
    #define E_ENABLE_PIN -1

    #define LED_PIN -1
    #define FAN_PIN -1
    #define PS_ON_PIN 15
    #define KILL_PIN -1

    ++++++++++++++++++++++++++++

    Brian_B wrote: »
    My pin suggestions,

    1- x step
    1- x dir
    1- x home

    1- y step
    1- y dir
    1- y home

    1- z step
    1- z dir
    1- z home

    1- a step (extruder)
    1- a dir (extruder)

    1- x,y,z,a enable
    1 -x,y,z overlimit (this is optional)

    1- pwm extruder heater
    1- adc extruder thermoresistor

    *** optional *****
    1- pwm bed heater (for abs plastic)
    1- adc bed thermoresistor
    1- pwm cooling fan
    1- Estop


    Brian

    Grouping the XYZ enable to one i/o pin is brilliant idea... wise economy
    A pwm bed heater is a later possilbity and its ADC for bed thermosresistor
    A pwm cooling fan is also possible.
    Estop -- maybe already included.

    If you are willing to run bench test of a Propeller driven 3D printer on an actual printer bed (seems none of us really have one), accommodating desired features would likely occur.

    The fundamental need-to-know is which g-code compile are targeting for actual use - Teacup or something else? Several of these options are NOT in Teacup. Do you want a serial port to monitor from a keyboard and provide overrides, or do you want M codes to look to a g-code file for all and everything?
Sign In or Register to comment.