ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Cores are the underlying magic that make the Arduino API possible
User avatar
Kenjutsu
Posts: 134
Joined: Fri May 29, 2015 8:26 am

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by Kenjutsu » Thu Jun 15, 2017 7:55 am

dannyf wrote:Mine is easier to set up and get going however.
Very true ;) I tried his on Windows and Linux, without success, and only got it working on macOS :D

Thank you for uploading your code on github 8-) 8-) (https://github.com/dannyf00/STM8Sduino)
Pieter

OSX: 10.12.6
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by zoomx » Thu Jun 15, 2017 2:35 pm

Since I have two of these STM8 cheap boards....
I'm watching this project on github and on blog.
Hope to find time to test it soon.

User avatar
Kenjutsu
Posts: 134
Joined: Fri May 29, 2015 8:26 am

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by Kenjutsu » Fri Jun 16, 2017 2:00 pm

Any plans on making STM8Sduino compile using SDCC? STM8S Standard Peripheral Library Ported to SDCC for multiple STM8 targets is already done. Since I use macOS it would be nice to use the native port of SDCC for playing with STM8Sduino ;) ;)
Pieter

OSX: 10.12.6
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

dannyf
Posts: 167
Joined: Wed May 11, 2016 4:29 pm

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by dannyf » Fri Jun 16, 2017 8:05 pm

Kenjutsu, there is currently no plan to port it to other compilers.

With that said, the code is fairly standard c so I wouldn't expect much issue porting it over to a decent c compiler.

Of the two other compilers for stm8, I have limited experience with SDCC - played around it briefly and discovered that it would discard unused sections and moved on.

Porting to cosmic should be fairly easy - mostly around ist declarations.

If you want, show me the error log for SDCC and I can go through the document to help you port it to that compiler.

In the mean time I will make the code work for cosmic.

edit: the existing STM8Sduino code base actually was written to allow compilation under COSMIC and RAISONANCE compilers but I commented out the cross-platform stuff. so I have re-instated the support now for those two compilers and the code now should compile under all three compilers, IAR, COSMIC and RAISONANCE.

I also took a quick look at SDCC compiler manual and the only difference I saw was the declaration of interrupts. The INTERRUPT_HANDLER macro could be written fairly easily to map back to the SDCC style - ST showed how to do that towards the end of stm8s.h.

edit 2: I uploaded the revised files to provide support for COSMIC (tested) and RAISONANCE. aside from interrupt handling, COSMIC doesn't support "inline" - fairly easy to deal with. Should compile for RAISONANCE - not tested however.
Last edited by dannyf on Sat Jun 17, 2017 12:36 am, edited 2 times in total.

User avatar
RogerClark
Posts: 7489
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by RogerClark » Fri Jun 16, 2017 9:43 pm

I am not sure I would bother building an STM8 in preference to a STM32F103 board.

But, I have noticed a lot of cheap devices use the STM8, so having a way to repurpose those devices would be good.

e.g. I have a several LED panel mount volt meters which use the STM8, and I recently took a USB voltage and current dongle apart and it also contains a STM8.

Considering STM have literally sold billions of STM8 MCUs, I am sure having a usable STM8 Arduino toolchain would be very beneficial to device hackers

User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by zoomx » Sat Jun 17, 2017 10:12 am

dannyf wrote: edit: the existing STM8Sduino code base actually was written to allow compilation under COSMIC and RAISONANCE compilers but I commented out the cross-platform stuff. so I have re-instated the support now for those two compilers and the code now should compile under all three compilers, IAR, COSMIC and RAISONANCE.
Testing with SDCC I get

Code: Select all

In file included from stm8sduino.h:56,
                 from example.c:1:
stm8s.h:90:3: error: #error "Unsupported Compiler!"
stm8s.h:2735:25: fatal error: intrinsics.h: No such file or directory
compilation terminated.
That's true, intrinsics.h doesn't exist in the SDCC folders!

User avatar
RogerClark
Posts: 7489
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by RogerClark » Sat Jun 17, 2017 10:52 am

I had to order some other things from eBay so I ordered 2 x STM8 boards as they are cheap

I probably will never use them, but I like to be prepared in case I need something like that ;-)

User avatar
Kenjutsu
Posts: 134
Joined: Fri May 29, 2015 8:26 am

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by Kenjutsu » Sat Jun 17, 2017 1:03 pm

zoomx wrote: Testing with SDCC I get

Code: Select all

In file included from stm8sduino.h:56,
                 from example.c:1:
stm8s.h:90:3: error: #error "Unsupported Compiler!"
stm8s.h:2735:25: fatal error: intrinsics.h: No such file or directory
compilation terminated.
That's true, intrinsics.h doesn't exist in the SDCC folders!
The same here. To solve this, use stm8s.h from STM8S Standard Peripheral Library Ported to SDCC for multiple STM8 targets

When I then compile stm8sduino.c I get the following errors:

Code: Select all

stm8sduino.c:249: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
stm8sduino.c:249: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
stm8sduino.c:249: warning 126: unreachable code
stm8sduino.c:250: warning 126: unreachable code
stm8sduino.c:249: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
stm8sduino.c:249: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
stm8sduino.c:249: warning 126: unreachable code
stm8sduino.c:250: warning 126: unreachable code
stm8sduino.c:593: syntax error: token -> 'uint16_t' ; column 9
stm8sduino.c:595: error 20: Undefined identifier 'tmp'
stm8sduino.c:595: error 20: Undefined identifier 'tmp'
stm8sduino.c:596: error 20: Undefined identifier 'tmp'
stm8sduino.c:632: warning 85: in function serial1Begin unreferenced function argument : 'BaudRate'
stm8sduino.c:898: warning 116: left shifting more than size of object changed to zero
stm8sduino.c:934: warning 116: left shifting more than size of object changed to zero
Pieter

OSX: 10.12.6
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

User avatar
Kenjutsu
Posts: 134
Joined: Fri May 29, 2015 8:26 am

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by Kenjutsu » Sat Jun 17, 2017 1:05 pm

RogerClark wrote:But, I have noticed a lot of cheap devices use the STM8, so having a way to repurpose those devices would be good.
Have a look here eForth for cheap STM8S gadgets
Pieter

OSX: 10.12.6
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

dannyf
Posts: 167
Joined: Wed May 11, 2016 4:29 pm

Re: ARMduino - a generic implementation of Arduino on ARM Cortex-M chips

Post by dannyf » Sat Jun 17, 2017 1:14 pm

The intrinsic come from stm8s.h and you can comment it out - I don't remember using anything there in particular. Maybe mop?

The complaints around line 590 on tmp is because it was declared in the middle of that function. I have since moved it to the beginning of the function.

Fixed that and see what else may pop up.

The complaints about unreachable issue to infinite loop.

Not sure about Evelyn and Dog.

Post Reply