Commit Graph

1593 Commits

Author SHA1 Message Date
Nico Tonnhofer 2da993220e STM32F411: add CNC Shield V3 for Nucleo to the series of regression tests.
Now Nucleo F411RE based boards are covered as well :-)
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 3e76406b8c STM32F411: add CNC Shield V3 for Nucleo Pinout 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 01be683b6c STM32F411: Enable all GPIO-clocks in SystemInit()
Serial pins are also there.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer fd81ea9c60 STM32F411: prettify cmsis-system_stm32f4xx.c/.h.
Remove trailing whitespace and such stuff.
2017-03-03 18:54:56 +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 be4c4eb90b STM32F411: prettify cmsis-core / cmsis-stm
This is just wording for the Teacup changes notes consistent with
    the other cmsis- files.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 487e6ff6ec STM32F411: rename mbed-core_cm4.h and mbed-core_cm4_simd.h
to cmsis-core_cm0.h and cmsis-core_cm4_simd.h

    Part of the effort to rename all CMSIS-provided files to "cmsis-".
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 7dd657d56a STM32F411: rename mbed-stm32f4xx.h to cmsis-stm32f4xx.h.
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 b9107397b2 STM32F411: serial-stm32.c: allow sending arbitrarily long messages.
On ARM we use only the 16 byte hardware buffer for sending and
receiving over the serial line, which is often too short for
debugging messages. This implementation works fine and still
neither blocks nor introduces delays for short messages.

Removed while-loop. Looks like we need some more us than the LPC?!? With +7us
we do not lose characters anymore.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 2a96564228 STM32F411: get delay-stm32.c in 2017-03-03 18:54:56 +01:00
Nico Tonnhofer c0cd80bbc3 ARM: rename delay-arm.c to delay-lpc.c 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 3af3919303 STM32F411: clean mbed-stm32f4xx_*.h from *_ex.h
Everything in one shot is too much. Really easy to delete those _ex.h-files.
    SIZES          ARM...     stm32f411
    FLASH  :  3132 bytes           1%
    RAM    :   212 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 73df1be2d2 STM32F411: implement PULLUP_ON() and PULLUP_OFF(). 2017-03-03 18:54:55 +01:00
Nico Tonnhofer 313e37c0b2 STM32F411: implement SET_INPUT() and READ(). 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 3a9a442c26 STM32F411: get FastIO for writing into place. 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 3c79d2f11c ARM: Rename serial-arm.c to serial-lpc.c 2017-03-03 18:54:55 +01:00
Nico Tonnhofer 79010723b1 STM32F411: 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.

    SIZES          ARM...     stm32f411
    FLASH  :  4832 bytes           1%
    RAM    :   404 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer d44c03a1b7 STM32F411: get rid of mbed-error.c and mbed-mbed_error.h
SIZES          ARM...     stm32f411
    FLASH  :  5252 bytes           2%
    RAM    :   404 bytes           1%
    EEPROM :     0 bytes           0%
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
Nico Tonnhofer 8a4cd52a68 DDA: Fix slow travel speed
@phord abstract this to: This happens only when !recalc_speed,
meaning we are cruising, not accelerating or decelerating. So it
pegs our dda->c at c_min if it never made it as far as c_min.

This commit will fix https://github.com/Traumflug/Teacup_Firmware/issues/69
2017-02-28 22:08:25 +01:00
Nico Tonnhofer 51075caaa9 dda.h: steps also for acceleration reprap
With the rework and revert of some commits we miss to bring this part back for acceleration reprap.
2017-02-24 21:51:32 +01:00
Nico Tonnhofer e707c395f3 Revert "dda.c: let's save 3 divisions."
delta_um can become very small, where maximum_feedrate_P is constant.
When moving this division out of the loop, the result can be wrong.
dda->total_steps becomes also very small with delta_um. So this will fit perfectly.

This reverts commit cd66feb8d1.
2017-02-13 19:04:21 +01:00
Nico Tonnhofer 1e052a77a2 DDA: The test of total_steps against step_no was a good idea.
So let's bring this part back.

We save 35 clock cycles at 'LED on time maximum'

ATmega sizes               '168   '328(P)   '644(P)     '1280
Program:  18038 bytes      126%       59%       29%       14%
   Data:   1936 bytes      190%       95%       48%       24%
 EEPROM:     32 bytes        4%        2%        2%        1%

short-moves.gcode statistics:
LED on occurences: 888.
LED on time minimum: 217 clock cycles.
LED on time maximum: 520 clock cycles.
LED on time average: 249.626 clock cycles.

smooth-curves.gcode statistics:
LED on occurences: 22589.
LED on time minimum: 217 clock cycles.
LED on time maximum: 537 clock cycles.
LED on time average: 284.747 clock cycles.

triangle-odd.gcode statistics:
LED on occurences: 1636.
LED on time minimum: 217 clock cycles.
LED on time maximum: 520 clock cycles.
LED on time average: 270.933 clock cycles.
2017-02-13 19:04:21 +01:00
Nico Tonnhofer 22489c69cb dda.c: simply resort the values and save up to 8 clocks
ATmega sizes               '168   '328(P)   '644(P)     '1280
Program:  18266 bytes      128%       60%       29%       15%
   Data:   1936 bytes      190%       95%       48%       24%
 EEPROM:     32 bytes        4%        2%        2%        1%

short-moves.gcode statistics:
LED on occurences: 888.
LED on time minimum: 243 clock cycles.
LED on time maximum: 555 clock cycles.
LED on time average: 250.375 clock cycles.

smooth-curves.gcode statistics:
LED on occurences: 22589.
LED on time minimum: 243 clock cycles.
LED on time maximum: 572 clock cycles.
LED on time average: 292.139 clock cycles.

triangle-odd.gcode statistics:
LED on occurences: 1636.
LED on time minimum: 243 clock cycles.
LED on time maximum: 555 clock cycles.
LED on time average: 275.699 clock cycles.
2017-02-13 19:04:20 +01:00
Nico Tonnhofer b36aa4168a Revert "DDA: don't count individual axis steps." 2017-02-13 19:04:20 +01:00
Nico Tonnhofer e52b1d2a69 DDA:testing steps
start the simulation with ./parse_clean xyz, where 'xyz' can be anything to name the created files.

in the end you will get 3 pictures.
swan-reference-xyz.png how it should looks like.
swan-current-xyz.png how it will looks now.
swan-diff-xyz.png is the difference.

This 3 pictures show only the X-axis.

you will get also a forth file. pp-xyz.asc. you can open this file for example with meshlab and you can see that current model in 3d.

If you want to use your own gcode, please do the following:
Create a normal gcode. Delete any M116 (temp waitings). Maybe you want also deleting comments.
Then add M114 for every x line.
I do this with the swan-test.gcode:
sed '1~2 s/$/\nM114/g' < swan.gcode > swan-test.gcode
2017-02-13 19:03:21 +01:00
Nico Tonnhofer c441548c37 dda.c: when we have no move on the cartesian axes, we have a move on E.
But we can also have very short moves with only 1 step, without E. So include this moves also.
2017-02-12 15:12:06 +01:00
Nico Tonnhofer 2ce27fd5f7 run-in-simulavr.sh: repair report.
Use the CONFIG setup some lines before. So it will also work when running this script solely.
2017-02-11 23:59:58 +01:00
Phil Hord 1e9cb8b8e1 dda->id is needed even when !LOOKAHEAD
In `ACCELERATION_RAMPING` code we use the dda->id field even when we do
not enable `LOOKAHEAD`. Expose the variable and its related `idcnt`
when `ACCELERATION_RAMPING` is used.

Add a regression-test to catch this in the future.
2017-02-01 10:21:48 -08:00
Phil Hord 80136a51d8 mb_tail_dda: some code forgot to check for null 2016-12-20 16:31:21 -08:00
Wurstnase 4573a8fbbb dda.c: move code to reduce size.
No functional change. Reduces program size by 2 bytes:

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  17942 bytes      126%       59%       29%       14%
     Data:   1920 bytes      188%       94%       47%       24%
   EEPROM:     32 bytes        4%        2%        2%        1%
2016-12-15 20:31:07 +01:00
Wurstnase 3c3500b388 Testcases: run them faster.
Simple trick: raise the feedrate, no need to care about a milling
bit when running a simulation. This reduces simulated time and as
such, duration of the simulation (by about 50%).

Also remove G-code which was never executed because simulations
are chopped at 1 minute of simulation time and smooth-curves.gcode
took about 1.5 minutes.

Step pulse measurements remain about the same:

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  17944 bytes      126%       59%       29%       14%
     Data:   1920 bytes      188%       94%       47%       24%
   EEPROM:     32 bytes        4%        2%        2%        1%

  short-moves.gcode statistics:
  LED on occurences: 888.
  LED on time minimum: 202 clock cycles.
  LED on time maximum: 380 clock cycles.
  LED on time average: 232.092 clock cycles.

  smooth-curves.gcode statistics:
  LED on occurences: 22589.
  LED on time minimum: 194 clock cycles.
  LED on time maximum: 423 clock cycles.
  LED on time average: 254.425 clock cycles.

  triangle-odd.gcode statistics:
  LED on occurences: 1636.
  LED on time minimum: 220 clock cycles.
  LED on time maximum: 380 clock cycles.
  LED on time average: 245.575 clock cycles.
2016-12-15 20:12:41 +01:00
Markus Hitter 84dcd089d4 DDA: get rid of dda->delta_um[].
These values were queued up just for finding out individual axis
speeds in dda_find_crossing_speed(). Let's do this calculation
with other available movement properties and save 16 bytes of RAM
per movement queue entry.

First version of this commit forgot to take care of the feedrate
sign (prevF, currF). Lack of that found by @Wurstnase. Idea of
tweaking calculation of 'dv' to achieve this also by @Wurstnase.

It was tried to set the sign immediately after calculation of the
absolute values, but that resulted in larger ( = slower) code.

Binary size down 132 bytes, among that two loops. RAM usage down
256 bytes for the standard test case:

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  17944 bytes      126%       59%       29%       14%
     Data:   1920 bytes      188%       94%       47%       24%
   EEPROM:     32 bytes        4%        2%        2%        1%
2016-12-15 20:00:29 +01:00
Phil Hord f0fa5f9f3e dda_lookahead.c: reduce size of ATOMIC section.
We calculate a safe join speed in dda_join_moves using data from
two source DDA movements. We ensure the DDA values we use are sane
by atomically copying them to local variables before beginning our
calculation. But later we discard all our results if the DDA went
live in the meantime, as evidenced by changes in `DDA->live` or
`DDA->id`.

Since we will not use the results of our calculations if either of
these change, we can safely reference all the other DDA values
non-atomically. Change the ATOMIC section to protect only the
`DDA->id` values at the start.

Added by Traumflug: this costs a negligible 4 bytes binary size:

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  18082 bytes      127%       59%       29%       15%
     Data:   2176 bytes      213%      107%       54%       27%
   EEPROM:     32 bytes        4%        2%        2%        1%
2016-12-09 22:51:05 +01:00
Wurstnase c33791333c dda_lookahead.c: remove unneeded assignments.
Gcc optimizes them out anyway. No functional change. No surprise,
same binary size.
2016-12-09 19:59:03 +01:00
Markus Hitter aa0ef9a3e0 AVR: turn on link time optimisation (LTO).
Following the resounding success on ARMs, let's try LTO on AVRs,
too. Advantage isn't all that well, binary size increases by 462
bytes and even an additional byte of RAM is needed.

According to @Wurstnase's research, this size increase is pretty
unique to the config.h.Profiling configuration. All other
configurations he tried actually showed a size drop.

Anyways, we have 15 to 17 clock cycles less on any step, so an
about 7% general stepping performance increase.

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  18078 bytes      127%       59%       29%       15%
     Data:   2176 bytes      213%      107%       54%       27%
   EEPROM:     32 bytes        4%        2%        2%        1%

  short-moves.gcode statistics:
  LED on occurences: 888.
  LED on time minimum: 202 clock cycles.
  LED on time maximum: 380 clock cycles.
  LED on time average: 232.092 clock cycles.

  smooth-curves.gcode statistics:
  LED on occurences: 23648.
  LED on time minimum: 220 clock cycles.
  LED on time maximum: 423 clock cycles.
  LED on time average: 255.22 clock cycles.

  triangle-odd.gcode statistics:
  LED on occurences: 1636.
  LED on time minimum: 220 clock cycles.
  LED on time maximum: 380 clock cycles.
  LED on time average: 245.575 clock cycles.
2016-12-08 20:06:02 +01:00
Markus Hitter b7bd1ad3d7 Makefile-AVR: solve the .siminfo section problem properly.
After researching this issue for the third time, I finally found
a proper solution: one can't keep an entire section without re-
writing the entire link script, but one can keep individual
symbols. That's what we do now, so we can use --gc-sections when
linking with SimulAVR support.

The problem came up again because -flto drops unused symbols, too.

This commit changes binary size drastically (1654 bytes less), so
let's take a new performance measurement snapshot:

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  17616 bytes      123%       58%       28%       14%
     Data:   2175 bytes      213%      107%       54%       27%
   EEPROM:     32 bytes        4%        2%        2%        1%

  short-moves.gcode statistics:
  LED on occurences: 888.
  LED on time minimum: 218 clock cycles.
  LED on time maximum: 395 clock cycles.
  LED on time average: 249.051 clock cycles.

  smooth-curves.gcode statistics:
  LED on occurences: 23648.
  LED on time minimum: 237 clock cycles.
  LED on time maximum: 438 clock cycles.
  LED on time average: 272.216 clock cycles.

  triangle-odd.gcode statistics:
  LED on occurences: 1636.
  LED on time minimum: 237 clock cycles.
  LED on time maximum: 395 clock cycles.
  LED on time average: 262.572 clock cycles.
2016-12-07 15:23:23 +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 39f66ef6b0 dda.c: pretty-format dda_start().
Formatting was messed up during all the recent changes.

Only whitespace and comment changes, no functional change.
2016-12-06 20:25:36 +01:00