Commit Graph

26 Commits

Author SHA1 Message Date
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
Markus Hitter 4cfeca08e1 ARM: get serial working based on MBED code.
Pretty complex, this MBED system, it requires no less than
24 additional files. This will be fleshd out before too long.

    SIZES          ARM...     lpc1114
    FLASH  :  5956 bytes          19%
    RAM    :   176 bytes           5%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:34 +02:00
Markus Hitter 9e9e946c6d Makefile-ARM: get uploading to work. 2015-08-12 14:26:34 +02:00
Markus Hitter 3cc81cdba8 Makefile-ARM: adjust sizes reporting to our only target. 2015-08-12 14:26:33 +02:00
Markus Hitter 575174940f ARM: get a minimum amount of Teacup compiled for ARM.
Makefile can't even upload, yet.

    SIZES          ARM...     lpc1114
    FLASH  :   944 bytes           3%
    RAM    :   132 bytes           4%
    EEPROM :     0 bytes           0%
2015-08-12 14:26:33 +02:00