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

Cores are the underlying magic that make the Arduino API possible
dannyf
Posts: 140
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:19 pm

Those 4 digit volt meters use rx and tx pins routed out, making it possible for then to be daise chained together as a 4 digit standalone or 8 digit or 12 digit displays.

User avatar
Kenjutsu
Posts: 130
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:46 pm

dannyf wrote: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.

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:899: warning 116: left shifting more than size of object changed to zero
stm8sduino.c:935: warning 116: left shifting more than size of object changed to zero
stm8sduino.c:1094: error 9: FATAL Compiler Internal Error in file '/Users/sdcc-builder/build/sdcc-build/orig/sdcc/src/SDCCicode.c' line number '1150' : isOperandLiteral (op)
Contact Author with source code
:shock:
OSX: 10.12.5
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

dannyf
Posts: 140
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 4:50 pm

I cannot find anything of interest on line 249 / 250, or 899 and 935. Maybe you can copy those lines over, +/- 5 lines?

Again, those mentions of Evelyn / Dog mean nothing to me. Looks to be very SDCC specific.

User avatar
RogerClark
Posts: 6907
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 9:22 pm

Kenjutsu wrote:
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
I tried Forth years ago, but could not get to grios with it. But I have been doing embedded programming in C, on and off, for than I care to mention

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

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

Post by Kenjutsu » Sun Jun 18, 2017 3:12 pm

dannyf wrote:
Sat Jun 17, 2017 4:50 pm
I cannot find anything of interest on line 249 / 250, or 899 and 935. Maybe you can copy those lines over, +/- 5 lines?

Again, those mentions of Evelyn / Dog mean nothing to me. Looks to be very SDCC specific.
I got rid of the " Evelyn / Dog" messages by removing inline from
  • void pinMode(PIN_TypeDef pin, uint8_t mode)
  • void digitalWrite(PIN_TypeDef pin, uint8_t val)
  • int digitalRead(PIN_TypeDef pin)
The "warning 116: left shifting more than size of object changed to zero" and "error 9: FATAL Compiler Internal Error" messages are in void mcu_init(void) at the following lines:

Code: Select all

TIM1->ARRL = (PWM_PR);					//top at 0x0fff

Code: Select all

TIM2->ARRL = (PWM_PR);					//top at 0x0fff

Code: Select all

interrupts();
Pieter
OSX: 10.12.5
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

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

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

Post by dannyf » Sun Jun 18, 2017 5:27 pm

The first two are ok. They cast the lab of a 16 bit type to arrl. If you want, you can manually cast pwm pr to uint8.

I will take a look at interrupts. It maps back to ei and I will see how interrupts are enabled or disabled in sdcc.

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

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

Post by dannyf » Sun Jun 18, 2017 9:37 pm

I took a look at the SDCC manual. The issue with interrupts() is its use of an IAR-specific call.

You can recreate that via assembly instructions "rim" and "sim".

To make it more seamless, you can change the stm8s.h file, especially in the beginning where it complains about unsupported compiler - simply insert another #elif for SDCC and you are ready to go.

User avatar
Kenjutsu
Posts: 130
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 22, 2017 1:30 pm

dannyf wrote:
Sun Jun 18, 2017 9:37 pm
I took a look at the SDCC manual. The issue with interrupts() is its use of an IAR-specific call.

You can recreate that via assembly instructions "rim" and "sim".

To make it more seamless, you can change the stm8s.h file, especially in the beginning where it complains about unsupported compiler - simply insert another #elif for SDCC and you are ready to go.
I use stm8s.h from STM8S Standard Peripheral Library Ported to SDCC for multiple STM8 targets which contain the required #idefs for SDCC, including what is needed for interrupts, but still "error 9: FATAL Compiler Internal Error" is in void mcu_init(void). I have a feeling SDCC is not happy about something else in this function, and not about that specific line :(

Update:
I placed a simple for loop after the line SDCC complains about, and now interrupts() no longer generates the error, but the for loop after it... Will have to dig deeper
OSX: 10.12.5
Arduino IDE: 1.6.12
Blue pill STM32F103C8T6 Dev Board
Maple Mini Clones

dannyf
Posts: 140
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 23, 2017 9:42 am

for maximum compatability, I mapped interrupts() -> ei() -> enableInterrupts(), which is then mapped to __asm()__ by your STM8S.h file. so it should work.
but the for loop after it.
that would suggest that the issue is with the preceding statements - you can confirm it by commenting out interrupts() in mcu_init().

What do your USE_XXX macros look like?

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

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

Post by dannyf » Sun Jun 25, 2017 10:43 pm

dannyf wrote:
Sat Jun 17, 2017 1:19 pm
Those 4 digit volt meters use rx and tx pins routed out, making it possible for then to be daise chained together as a 4 digit standalone or 8 digit or 12 digit displays.
I ordered a couple of those units from eBay to test out that concept. While waiting for them, I wrote up a simple piece of code on a PIC16F193x (@16Mhz). So far, it has lived nicely on a simulator - I daisy-chained two of them together to form an 8-digit display. The code is available from github.

I would expect minimum changes to retarget the code for STM8.

Post Reply