madleech / ArduinoCMRI

Arduino library for connecting your computer to your model railroad.
27 stars 18 forks source link

Curious about porting this project for Energia (TI MSP430 Launchpad Family) #2

Closed hoffy closed 10 years ago

hoffy commented 10 years ago

I have spent the day fiddling with your library trying to see if I could get it to port over into the Energia "Arduino Fork IDE". I was not having any success. I as well has many others who play with the MSP430's would get a lot of play out of this. I'm will to help with testing on the MSP430 platform.

madleech commented 10 years ago

Hi Hoffy,

What isn't working? Are you getting compile errors, or are you unable to get it to respond when using it in a JMRI system? Have you followed the directions at the top of the "hello world" sample program for setting it up with JMRI?

The code is very platform-agnostic, it doesn't use any AVR-specific features so should work fine in Energia.

--Michael

hoffy commented 10 years ago

Hi Michael,

I am getting compile errors. I can't quite seem to wrap my head around a resolution to it. I expected it to compile fine as well, and does just fine within Arduino IDE.

Here is the output from the bottom console of Energia.

C:\Users\Steve\Desktop\energia-0101E0010\hardware\tools\msp430\bin\msp430-g++ -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=msp430g2553 -DF_CPU=16000000L -MMD -DARDUINO=101 -DENERGIA=10 -IC:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\cores\msp430 -IC:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\variants\launchpad -IC:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI C:\Users\Steve\AppData\Local\Temp\build1721320052316381893.tmp\hello_world.cpp -o C:\Users\Steve\AppData\Local\Temp\build1721320052316381893.tmp\hello_world.cpp.o

C:\Users\Steve\Desktop\energia-0101E0010\hardware\tools\msp430\bin\msp430-g++ -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=msp430g2553 -DF_CPU=16000000L -MMD -DARDUINO=101 -DENERGIA=10 -IC:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\cores\msp430 -IC:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\variants\launchpad -IC:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI -IC:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\utility C:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\CMRI.cpp -o C:\Users\Steve\AppData\Local\Temp\build1721320052316381893.tmp\CMRI\CMRI.cpp.o

C:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\CMRI.cpp: In constructor 'CMRI::CMRI(unsigned int, unsigned int, unsigned int)': C:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\CMRI.cpp:34:44: error: 'calloc' was not declared in this scope C:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\CMRI.cpp: In member function 'void CMRI::set_length(unsigned int, unsigned int)': C:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\CMRI.cpp:54:53: error: 'realloc' was not declared in this scope C:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\CMRI.cpp: In member function 'char CMRI::process()': C:\Users\Steve\Desktop\energia-0101E0010\hardware\msp430\libraries\CMRI\CMRI.cpp:80:9: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null]

Thanks for the response, I know a bunch of people who may enjoy this on the MSP430 as well as the Launchpad. My particular interest in regard to the MSP430 is cost as I am limited on resources as I am disabled.
This will be a giant cost saver to me if we get it to work.

Steve "Hoffy" Hofmeister Hoffy's World Website http://hoffysworld.com Hoffy's World Facebook https://www.facebook.com/pages/Hoffys-World/291487184220303 Follow @Hoffys_World http://twitter.com/intent/user?screen_name=Hoffys_World Hear me occasionally on The Model Rail Radio Podcast http://www.modelrailradio.com

On 9/24/2013 6:39 PM, Michael Adams wrote:

Hi Hoffy,

What isn't working? Are you getting compile errors, or are you unable to get it to respond when using it in a JMRI system? Have you followed the directions at the top of the "hello world" sample program for setting it up with JMRI?

The code is very platform-agnostic, it doesn't use any AVR-specific features so should work fine in Energia.

--Michael

— Reply to this email directly or view it on GitHub https://github.com/madleech/ArduinoCMRI/issues/2#issuecomment-25048520.

http://twitter.com/intent/user?screen_name=Hoffys_World

madleech commented 10 years ago

Fantastic, that's very useful. Seems that I was using AVR specific code, in that calloc and realloc aren't supported by the MSP430 libc. So I've changed the former to use malloc and removed the latter, since how useful is it to be able to resize the storage space on the fly anyway? I can't imagine any real reason to ever need to do that.

Steve, could you download the updated library and try again please? Note that it won't compile for the MSP430g2231 as it doesn't have enough flash storage space, but it should compile correctly for any other MSP.

hoffy commented 10 years ago

Well, that would explain why I could not figure out the issue. I never considered that it was not supported. I look forward to testing it. I will report back soon.

Thanks for taking the time to look into it!

Steve "Hoffy" Hofmeister

Hoffy's World Website http://hoffysworld.com Hoffy's World Facebook https://www.facebook.com/pages/Hoffys-World/291487184220303 Follow @Hoffys_World http://twitter.com/intent/user?screen_name=Hoffys_World Hear me occasionally on The Model Rail Radio Podcast http://www.modelrailradio.com

hoffy commented 10 years ago

It appears to be compiling fine now, I will do a physical test before

the day is out and report on that was well.

Steve "Hoffy" Hofmeister

Hoffy's World Website http://hoffysworld.com Hoffy's World Facebook https://www.facebook.com/pages/Hoffys-World/291487184220303 Follow @Hoffys_World http://twitter.com/intent/user?screen_name=Hoffys_World Hear me occasionally on The Model Rail Radio Podcast http://www.modelrailradio.com

hoffy commented 10 years ago

Works like a charm. I ran the Hello World example, after following your instructions as written. Other than setting the RXD & TXD Pins of the MSP430 to Hardware UART no special changes are needed.

I am going to have a lot of fun playing with this little beauty. Thanks for the modification.

Steve "Hoffy" Hofmeister

Hoffy's World Website http://hoffysworld.com Hoffy's World Facebook https://www.facebook.com/pages/Hoffys-World/291487184220303 Follow @Hoffys_World http://twitter.com/intent/user?screen_name=Hoffys_World Hear me occasionally on The Model Rail Radio Podcast http://www.modelrailradio.com

madleech commented 10 years ago

Fantastic! Thanks very much for your help debugging and testing this, I look forward to hearing what you do with it.