Skip to content

ww21.4 Intermediate Release #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed

ww21.4 Intermediate Release #3

wants to merge 16 commits into from

Conversation

climberhunt
Copy link

Serial.begin() read() write() on pins 0 and 1 on header.
Many other changes on init code and interrupt handling, plus timer functions.
See comment history for more information.

David Hunt and others added 16 commits May 19, 2015 11:48
Adding analogWriteResolution and analogReadResolution

Signed-off-by: Dan O'Donovan <[email protected]>
Signed-off-by: David Hunt <[email protected]>
Author: Dan O'Donovan <[email protected]>
Date:   Fri May 15 14:46:08 2015 +0100

Framework code extracted from the following commit ID in
Intel's thunderdome git repo: 8b198659675cd820072bdeb00d0c5de87c6f6ee2

This brings the necessary library code into the source tree, but not
yet integrated in the Arduino run-time environment (to follow shortly).

Signed-off-by: Dan O'Donovan <[email protected]>
Signed-off-by: David Hunt <[email protected]>
Intial release of serial functionality, Serial.write, print, println, read
Also added files required, Ringbuffer (not used yet), Print, etc.
Also some small changes to make Intel toolchain work, still more work needed.

Signed-off-by: David Hunt <[email protected]>
A first draft for the following functions:
    * delay()
    * millis();
    * micros();
Not yet implemented:
    * delayMicroseconds.

Author: Bogdan Pricop <[email protected]>

Signed-off-by: Bogdan Pricop <[email protected]>
Signed-off-by: David Hunt <[email protected]>
Adding heap section with start/end marker symbols to satisfy
malloc() and friends

Signed-off-by: Dan O'Donovan <[email protected]>
Signed-off-by: Bogdan Pricop <[email protected]>
Issue:
    A simple blink sketch having a 10 ms delay between blinks crashed
    after a few seconds.
    It looks like the stack got corrupted.
Root cause:
    The generic assembly hardware ISR, "_do_isr", was not properly
    written; the "sp" was not properly handled.
Solution:
    Replace the assembly hardware ISR with a C function having
    "__attribute__((interrupt("ilink")))"

Note:
    We need this generic hardware ISR because the IVT is in flash and
    we cannot change it at runtime.

Signed-off-by: Bogdan Pricop <[email protected]>
Signed-off-by: David Hunt <[email protected]>
Framework code extracted from the following commit ID in
Intel's thunderdome git repo: 8b198659675cd820072bdeb00d0c5de87c6f6ee2

This brings the necessary library code into the source tree, but not
yet integrated in the Arduino run-time environment (to follow shortly).

Signed-off-by: Dan O'Donovan <[email protected]>
Eliminating compiler warnings and cleanup.

Signed-off-by: Dan O'Donovan <[email protected]>
Signed-off-by: David Hunt <[email protected]>

Conflicts:
	system/libarc32_edu/drivers/ns16550.c
	system/libarc32_edu/drivers/uart.h
	system/libarc32_edu/main.c
Interrupt handling - add hw context saving

* Disable instruction cache (we don't need it at this stage)
* Setup automatic (hardware) context saving feature for non-fast
  interrupts.
* Set optimization to none (-O0) in Makefile.

Signed-off-by: Bogdan Pricop <[email protected]>
Signed-off-by: David Hunt <[email protected]>

Author:    Bogdan Pricop <[email protected]>
Interrupt handling - add hw context saving

* Disable instruction cache (we don't need it at this stage)
* Setup automatic (hardware) context saving feature for non-fast
  interrupts.
* Set optimization to none (-O0) in Makefile.

build: Eliminating compiler warnings

Fix interrupt handling bug

    Issue:
        A simple blink sketch having a 10 ms delay between blinks crashed
        after a few seconds.
        It looks like the stack got corrupted.
    Root cause:
        The generic assembly hardware ISR, "_do_isr", was not properly
        written; the "sp" was not properly handled.
    Solution:
        Replace the assembly hardware ISR with a C function having
        "__attribute__((interrupt("ilink")))"

    Note:
        We need this generic hardware ISR because the IVT is in flash and
        we cannot change it at runtime.

Allocating more SRAM to ARC (syncing with latest Thunderdome mem allocation)

build: Removing sdata section declaration from linker scripts

    ARC doesn't support an SDATA section bigger than 1024 bytes, and
    we overflow this too easily when we link in code that hasn't been
    compiled with the -mno-sdata compiler flag.  So we will ensure that
    we only use code compiled with -mno-sdata (including standard C lib)
    and we remove this section declaration to weed out any exceptions to this.
    In other words, if we link any code that tries to use the sdata section,
    we will see a linker error.

build: Adding HEAP section

    Adding heap section with start/end marker symbols to satisfy
    malloc() and friends

Signed-off-by: David Hunt <[email protected]>
final cleanup before push. no functional changes.
Minor tidy-up to interrupt init code

Currently, timer init functions enable global interrupts.  This should
be done in the interrupt setup code during the chip init sequence.

Signed-off-by: Dan O'Donovan <[email protected]>
Signed-off-by: David Hunt <[email protected]>
small cleanup around interrupt init code.

Signed-off-by: David Hunt <[email protected]>
* Fix delay() issue
        Issue: If value of microsecond is Timer0 limit, arcv2_timer0_count_get()
        microseconds condition will always be true, spinning for ever.
        The main issue is that the time between 2 consecutive readings of
        COUNT0 register is around 90 ticks and the Timer may overflow
        before the next reafing of COUNT0 if last values read > LIMIT - 90.
        Fix: Take in consideration the number of overflows. If TIMER0 overflows
        just leave the loop (even if COUNT0 < microseconds)
* Restructure a bit arcv2_timer0_enable() function in order to reflect the
      procedure described in chapter 3.3.76.1 of DesignWare ARCv2 ISA
      Programmer's Reference Manual.
      Make sure Timer0 initialisation clears the counter register as well.
* code review - added yield via hooks.c
* added back in strip stage when building
* Remove unused code in os.h, os_types.h and pf_init.h
* Uncomment call to yield() from delay() Arduino function; yield() is
      added for sake of compatibility.
* Remove dead code from timer0 init function.
* Commented out enable instruction cache
* Added Copyright header to wiring.c
* Setup automatic (hardware) context saving feature for non-fast interrupts
* Serial Communication API Initial checkin of Serial.read() and Serial.write()
  using header pins 0 and 1
* Eliminated some compiler warnings.

Signed-off-by: David Hunt <[email protected]>
@climberhunt
Copy link
Author

Closing pull request without merge. It's missing the pre-compiled library from the drivers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants