Commit Graph

54 Commits

Author SHA1 Message Date
Nico Tonnhofer b62bad1b0a stm32: rename __ARM_STM32F411__ to __ARM_STM32__ 2019-04-17 21:42:28 +02:00
Nico Tonnhofer bd5bfb3d76 stm32: new startup and linker script
also add stm32f446
http://git.munts.com/arm-mcu/gcc/stm32f4/
rename lpc startup from 's' to 'S' to let the c preprocessor do its job

stm32f4xx linker and startup file cmsis prefix just for naming
files has nothing todo with cmsis anymore
2019-04-17 21:42:25 +02:00
Nico Tonnhofer c5c58c82a8 Makefile: add an option flag for flto
e.g. for make regressiontests you could disable it for little faster test
simple: make regresstiontests USE_FLTO=no
2018-12-21 20:03:17 +01:00
Nico Tonnhofer e965931d9a Makefile-ARM: LPC1114 as standard
Much more users have a GEN7 ARM. So make it them more easy.
2017-11-04 07:30:25 +01:00
Nico Tonnhofer 230572b1d0 STM32F411: simplify cmsis files for stm32f411
Delete some macros from cmsis-file we will never use again.
Also replace magic numbers.
Add missing flag to allow -O0 (using R7 as register)
2017-03-05 15:00:12 +01:00
Nico Tonnhofer 8cf27adcba ARM: rename mbed-system_stm32f4xx.c/.h to cmsis-system_stm32f4xx.c/.h.
Last part of the effort to rename all CMSIS-provided files to "cmsis-".
2017-03-03 18:54:56 +01:00
Nico Tonnhofer e8e689b25c STM32F411: rename arm-startup_stm32f411xe.s to cmsis-startup_stm32f411xe.s. 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 1954780892 STM32F411: rename arm-stm32f411xe.ld to cmsis-stm32f411xe.ld
This is the start of renaming all CMSIS related files to
"cmsis-...".
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 534229c0fb STM32F411: get rid of RCC
..and finally one of the last mbed-files are gone.
remove mbed-stm32f4xx_hal_
- conf.h
- def.h
- rcc.c
- rcc.h
    SIZES          ARM...     stm32f411
    FLASH  :  1356 bytes           1%
    RAM    :   136 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 3da6cc9a2c STM32F411: remove tick, trick and tim
remove mbed-hal_tick_stm32.h/.c
and mbed-stm32f4xx_hal_tim..h/.c

Also mbed-cmsis_nvic_stm32.h/.c and mbed-cmsis_stm32.h isn't needed anymore

    SIZES          ARM...     stm32f411
    FLASH  :  2224 bytes           1%
    RAM    :   136 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:56 +01:00
Nico Tonnhofer d699644ea6 STM32F411: remove mbed-stm32f4xx_hal.c/.h
removed also HAL_IncTick()/HAL_GetTick()
    SIZES          ARM...     stm32f411
    FLASH  :  2252 bytes           1%
    RAM    :   136 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer eb8c5a39e1 STM32F411: cleaning mbed
delete mbed-stm32f4xx_hal_
- dma.h
- flash.h
- legacy.h
- pwr.h
- uart.h

    SIZES          ARM...     stm32f411
    FLASH  :  3108 bytes           1%
    RAM    :   208 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer a890fecc6d STM32F411: use arduino.h for UART pinout.
delete 11 mbed-files
    SIZES          ARM...     stm32f411
    FLASH  :  3124 bytes           1%
    RAM    :   212 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer 68e4d25eb3 STM32F411: get rid of mbed-core_cmFunc.h and mbed-core_cmInstr.h.
move some functions of them to mbed-core_cm4.h
2017-03-03 18:54:55 +01:00
Nico Tonnhofer e5494c6951 STM32F411: move serial handling code directly into serial-arm_stm.c 2017-03-03 18:54:55 +01:00
Nico Tonnhofer b1fa1e2e88 STM32F411: get rid of asserts.
No functional change, binary size 118 bytes smaller.
2017-03-03 18:54:55 +01:00
Nico Tonnhofer 03457bdf4f STM32F411: get serial working based on MBED code.
Needs over 50 files from mbed for the STM32F411.

    SIZES          ARM...     stm32f411
    FLASH  :  9220 bytes           2%
    RAM    :   424 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:53 +01:00
Nico Tonnhofer bf0cbb596f STM32F411: get minimum to compile and upload
SIZES          ARM...     stm32f411
    FLASH  :   900 bytes           3%
    RAM    :   136 bytes           4%
    EEPROM :     0 bytes           0%
2017-03-03 17:59:22 +01:00
Markus Hitter 877b9fae6f ARM: turn on link time optimisation (LTO).
Suggested by @Wurstnase. Apparently gcc got better, so it's
actually an advantage now.

Actually a pretty big advantage. While binary size decreases some
200 bytes, pulse length of the debug LED is a lot shorter
(measured on the scope):

  without LTO:  4.59 us
  with LTO:     3.65 us

That's a 25% performance increase by just turning on a flag!
2016-12-07 12:22:23 +01:00
Markus Hitter 7faab99671 board.gen7-arm.h: adjust for the released Gen7-ARM.
Just a few pin changes and similar stuff, no code change.
2016-03-27 20:36:03 +02:00
Markus Hitter 040e95b555 ARM: generic port is done, all printing relevant stuff works.
Also we can compile *.c now.

:-)
2015-08-13 17:12:13 +02:00
Markus Hitter 5c203b6689 ARM: get watchdog.c in.
The last .c file of the generic ARM port! Again made sure it
doesn't accidentially slip in.
2015-08-13 17:12:13 +02:00
Markus Hitter f8230d6565 ARM: get usb_serial.c in.
Once more just made sure it doesn't accidentially slip in without
giving the user a warning.
2015-08-13 17:12:13 +02:00
Markus Hitter fb317fef08 ARM: get spi.c, pff.c and pff_diskio.c (SD card handling) in.
Neither is ported for now, but also not essential for printing,
so it's just made sure it's always disabled on ARM.
2015-08-13 17:12:13 +02:00
Markus Hitter 274f6c954b ARM: get graycode.c and intercom.c in.
Also both used only in unusual setups, so no functional or binary
size change for ARM.
2015-08-13 17:12:12 +02:00
Markus Hitter cc6600ca76 ARM: get debug.c and crc.c in.
Both used only in special cases, so no binary size change.
2015-08-13 17:12:12 +02:00
Markus Hitter b849e28836 ARM: get home.c in.
As usual, homing works just fine.
2015-08-13 17:12:12 +02:00
Markus Hitter d7b59e2d33 ARM: implement heater-arm.c partially.
Currently at a fixed frequency of 1 kHz and with a fixed duty
cycle of 10%, but PWM does work.

As it turns out, PIO0_11 is not usable for PWM, because its timer
is already in use for the Step timer, and had to be disabled for
Gen7-ARM.

Test: define a heater in board.gen7-arm.h and a square signal
of 1 kHz with 10% duty cycle should appear on the heater pin.
2015-08-13 16:41:33 +02:00
Markus Hitter 8f24fbaad4 ARM: get temp.c in.
No code changes, but quite a few removals of __ARMEL_NOTYET__
guards. 20 such guards left.

Test: M105 should work and report plausible temperatures.

Current code size:

    SIZES          ARM...     lpc1114
    FLASH  :  9460 bytes          29%
    RAM    :  1258 bytes          31%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:37 +02:00
Markus Hitter 6b6aa84124 Makefile-ARM: disable Link Time Optimisation (-flto).
LTO makes generated assembly unreadable and also produces, despite
its intention, bigger binaries, currently by 90 bytes.
2015-08-12 14:26:37 +02:00
Markus Hitter f81000a4b6 ARM: implement analog-arm.c.
Very simple, because the LPC1114 features a hardware scan mode,
which automatically scans a given set of pins in freerunning mode
and stores all the values separately. No need for an interrupt!

Not yet done: configure not PIO1_0 and PIO1_1, but the pins
actually defined in the board file.

For testing, add this to ifclock(clock_flag_1s) in clock.c:
  uint8_t i;

  for (i = 0; i <= 7; i++) {
    sersendf_P(PSTR("%lu "), analog_read(i));
  }
  serial_writechar('\n');

This should print all 8 ADC values repeatedly. Only two pins are
actually set up, these values should change depending on the
thermistor temperature. More precisely: depending on the voltage
on the pin.
2015-08-12 14:26:37 +02:00
Markus Hitter 05c7cf067f ARM: get dda_lookahead.c in.
Not much to say, simply works.
2015-08-12 14:26:37 +02:00
Markus Hitter 5a8d51cb19 ARM: get dda_maths.c, dda_kinematics.c and dda.c in.
All in one chunk, because it's all hardware-independent and doing
them one by one would end up on not more than some typing
exercises.

Compiles fine. For testing, remove if (DEBUG... for M114 in
gcode_process.c. Then one can see how the queue fills up when
sending movements and M114 repeatedly. This time with actual
coordinates.

No stepper movements, yet, because set_timer() is still empty.
2015-08-12 14:26:37 +02:00
Markus Hitter 692a6daeb2 ARM: get dda_queue.c in.
Compiles fine. For testing, remove if (DEBUG... for M114 in
gcode_process.c. Then one can see how the queue fills up when
sending movements and M114 repeatedly.

queue_step() isn't called, yet, the stepper timer is still missing.
2015-08-12 14:26:37 +02:00
Markus Hitter c118d00383 ARM: get clock.c in.
No code changes neccessary.

This code in ifclock(clock_flag_1s) in clock.c should give a nice,
accurate clock:

    static uint8_t minutes = 0, seconds = 0;

    seconds++;
    if ( ! (seconds % 60)) {
      seconds = 0;
      minutes++;
    }
    sersendf_P(PSTR("%su:"), minutes);
    if (seconds < 10)
      serial_writechar('0');
    sersendf_P(PSTR("%su\n"), seconds);

Current sizes are:

    SIZES          ARM...     lpc1114
    FLASH  :  4440 bytes          14%
    RAM    :   200 bytes           5%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:36 +02:00
Markus Hitter 137a638658 ARM: get timer.c in, so far only with the system clock.
This test code in SysTickHanlder() should give you a rather
accurate clock with only a few seconds deviation per hour:

  #include "serial.h"
  #include "sersendf.h"
  void SysTick_Handler(void) {
    static uint32_t count = 0;
    static uint8_t minutes = 0, seconds = 0;

    count++;

    if ( ! (count % 500)) {   // A full second.
      seconds++;
      if ( ! (seconds % 60)) {
        seconds = 0;
        minutes++;
      }
      sersendf_P(PSTR("%su:"), minutes);
      if (seconds < 10)
        serial_writechar('0');
      sersendf_P(PSTR("%su\n"), seconds);
    }
  [...]
2015-08-12 14:26:36 +02:00
Markus Hitter 4faa3cbf8f ARM: bring in pinio.c.
This enables pinio_init(), power_on() and power_off(). Now one
can turn on the power supply with M119 and turn it off with M2.

Code changes were neccessary. Setting a pin first, then making
it an output doesn't work on ARM. A pin has to be an output
before it permanently accepts a given state. As I was never
sure the former strategy actually worked on AVR, the order of
these two steps was changed for both, AVR and ARM.
2015-08-12 14:26:36 +02:00
Markus Hitter 96f7dbd2b1 ARM: bring in gcode_process.c.
Again, the whole file compiled flawlessly without change. Still,
to get it linked as well, most of the functionality had to
be #ifdef'd out.

Nevertheless, the firmware shows first signs of life, e.g. M115
works.
2015-08-12 14:26:36 +02:00
Markus Hitter e5729d6743 ARM: get gcode_parse.c in.
Just did it, no code changes neccessary. Except ajusting the
boundaries to not yet ported code.

Successful tests: controller answers with "ok", just like an AVR.

Binary size raised, of course:

    SIZES          ARM...     lpc1114
    FLASH  :  3064 bytes          10%
    RAM    :   194 bytes           5%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:36 +02:00
Markus Hitter b1490658cf ARM: rename mbed-system_LPC11xx.c/.h to cmsis-system_lpc11xx.c/.h.
Last part of the effort to rename all CMSIS-provided files to
"cmsis-".
2015-08-12 14:26:36 +02:00
Markus Hitter 5fa7bfbf81 ARM: rename arm-startup_lpc11xx.s to cmsis-startup_lpc11xx.s. 2015-08-12 14:26:35 +02:00
Markus Hitter f2005f0018 ARM: rename arm-lpc-1114.ld to cmsis-lpc1114.ld.
This is the start of renaming all CMSIS related files to
"cmsis-...".
2015-08-12 14:26:35 +02:00
Markus Hitter 8377de8d66 ARM: get delay.c in.
Accuracy is pretty good, see committed comments :-)

Code used for testing, in main():

  uint32_t i;

  SET_OUTPUT(PIO0_1);
  while (1) {
    // 10 seconds for each frequency, so we
    // can measure all three with one upload.
    for (i = 10000; i > 0; i--) {
      WRITE(PIO0_1, 1);
      delay_us(1000);
      WRITE(PIO0_1, 0);
      delay_us(1000);
    }
    for (i = 1000; i > 0; i--) {
      WRITE(PIO0_1, 1);
      delay_us(10000);
      WRITE(PIO0_1, 0);
      delay_us(10000);
    }
    for (i = 200; i > 0; i--) {
      WRITE(PIO0_1, 1);
      delay_us(65000);
      WRITE(PIO0_1, 0);
      delay_us(65000);
    }
  }
2015-08-12 14:26:35 +02:00
Markus Hitter 52e2585f13 ARM: use arduino.h for UART pinout.
This removes another 36 bytes binary size and six(!) MBED files.

The mess of MBED files is now pretty much resolved, only a few
essential ones left.
2015-08-12 14:26:35 +02:00
Markus Hitter 43b2ac6e0b ARM: get sersendf.c/.h in.
Needed a bit a tweak to adjust va_arg() to 32 bit. Tests ran fine,
at the end it turned out mendel.c had an obsolete #include.
2015-08-12 14:26:34 +02:00
Markus Hitter 5dec638919 ARM: get sermsg.c/.h in.
Compiled flawlessly, ran all test flawlessly, and at the end it
turned out mendel.c had an obsolete #include. Very nice.
2015-08-12 14:26:34 +02:00
Markus Hitter 829e4d475b Makefiles: add a hint on how to list these predefined macros.
No functional change.
2015-08-12 14:26:34 +02:00
Markus Hitter 52f5a56d71 ARM: move serial handling code directly into serial-arm.c.
This makes another seven mbed files obsolete and reduces binary
size by another 100 bytes Flash and 16 bytes RAM:

    SIZES          ARM...     lpc1114
    FLASH  :  1624 bytes           5%
    RAM    :   140 bytes           4%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:34 +02:00
Markus Hitter 776f90ff2c ARM: simplify serial and get rid of mbed-pinmap_common.c.
We have only one UART, we use only one UART, so it's pointless to
do pin mapping calculations at runtime.

Binary size down by 268 bytes:
    SIZES          ARM...     lpc1114
    FLASH  :  1724 bytes           6%
    RAM    :   156 bytes           4%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:34 +02:00
Markus Hitter a5cb1bd31a ARM: get rid of mbed-mbed_error.h and mbed-error.c.
Same functionality, drastically smaller binary:

    SIZES          ARM...     lpc1114
    FLASH  :  1992 bytes           7%
    RAM    :   156 bytes           4%
    EEPROM :     0 bytes           0%

That's a reduction by 3948 bytes Flash and 20 bytes RAM.
2015-08-12 14:26:34 +02:00