Skip to content

[WIZnet][W7500*] unsupported RTC #4728

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 128 commits into from
Closed

[WIZnet][W7500*] unsupported RTC #4728

wants to merge 128 commits into from

Conversation

khj098765
Copy link
Contributor

unsupported RTC

justinkim added 2 commits July 10, 2017 10:09
@0xc0170
Copy link
Contributor

0xc0170 commented Jul 10, 2017

Can you please rework the commits (to rebase). The commit could be: Wiznet W7500*: remove RTC support and the second paragraph should state why it is being removed (not working, does not have RTC, or anything that could help explaining this removal. PWM3 pin enable in the second commit is another logical change, not related to RTC? or is it?

@khj098765
Copy link
Contributor Author

I was told to remove software RTC from Andrew Chong.
So we removed the RTC which was previously operated by PWM3.
We are going to pull request when, the internal RTC driver once it is complete.
PWM3 pin enable is related because it was used as RTC in the past.

theotherjimmy and others added 25 commits July 11, 2017 08:43
targets.json contained a key for some targets, `OUTPUT_EXT`, which I
moved to `Target`, the root of all targets. Following on that, the tools
now use this extension provided by `OUTPUT_EXT` to determine the file
type of the output executable.
The input format is now determined by the OUTPUT_EXT key in
targets.json, and defaults to "bin" when not specified. This changes the
Teensy3_1 and the NRF51x targets' post bulid hooks.

Teensy3_1 just converted to intelhex, so we do nothing instead.

NRF51x assumed that it was taking in a bin format file. I made it detect
file type by extension.
From opt.h:
IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast
filter on recv operations.

The IP_SOF_BROADCAST_RECV option does not enable or disable recieving
broadcast packets, it only enables a software filter.
The extra space between "--no_wrap_diagnostics" and "-e" is inconsistent with the development and release targets.

It bugs people (like me) that have little OCD tics 😉.
The current implementation of semihost_disabledebug() hangs when used
with mbed interface firwmare revision 21164, the first version which
added support for this semihost call. I encountered this hang when
running a Release build on my mbed-LPC1768 board as the RTOS attempted
to disable the debugger before the idle thread put the CPU to sleep.

The 21164 interface firmware expects that R1 points to a valid argument
block but the current implementation passes in NULL. The fix was to
pass in a dummy block which is ignored by the newer 141212 revision of
the firmware and allows the 21164 version to proceeed without halting
the CPU until a manual reset.

Before this fix semihost_disabledebug() did work with the latest
mbed interface firmware revision 141212 but I rarely use this revision
of the interface firmware due to the instability issues I have
encountered in the past with its CDC and LocalFileSystem functionality.

With this proposed fix, the code now works with both the 21164 and
141212 revisions of the mbed interface firmware on the mbed-LPC1768.
SERIAL_TX and SERIAL_RX pins used for debug printf cannot be set as available
ticker_insert_event() can crash on KLXX (and probably other platforms) if an event is inserted with a timestamp before the current real time.  

The problem is easy to trigger:  you just need to set up a Ticker object, and then disable interrupts for slightly longer than the Ticker object's interval.  It's generally bad practice to disable interrupts for too long, but there are some cases where it's unavoidable, and anyway it would be better for the core library function not to crash.  The case where I had an unavoidably long interrupts-off interval was writing flash with the FTFA.  The FTFA hardware prohibits flash reads while an FTFA command is in progress, so interrupts must be disabled for the whole duration of each command to ensure that there are no instruction fetches from flash-resident ISRs in the course of the execution.  An FTFA "erase sector" command takes a fairly long time (milliseconds), and I have a fairly high frequency Ticker (1ms).

The problem and the fix are pretty straightforward.  ticker_insert_event() searches the linked list to figure out where to insert the new event, looking for a spot earlier than any event currently queued.  If the event is in the past, it'll usually end up at the head of the list.  When the routine sees that the new event belongs at the head of the list, it calls data->interface->set_interrupt() to schedule the interrupt for the event, since it's the new soonest event.  The KLXX version of us_ticker_set_interrupt() then looks to see if the event is in the past, which we've stipulated that it is, so rather than actually setting the interrupt, it simply calls the handler directly.  The first thing the Ticker interrupt handler does is re-schedule itself, so we re-enter ticker_insert_event() at this point.  This is where the problem comes in:  we didn't finish updating the linked list before we called set_interrupt() and thus before we recursed back into ticker_insert_event().  We set the head of the list to the new event but we didn't set the new event's 'next' pointer.

The fix is simply to finish updating the list before we call set_interrupt(), which we can do by moving the obj->next initialization ahead of the head pointer update.
Originally the ethernet ISR would be linked in to all mbed-os based
firmware because it was named ENET_IRQHandler() so that it would be
automatically placed in the FLASH image's interrupt vector table. This
meant that programs which made no use of the lwIP stack still pulled in
this ISR.

This commit changes the name of the routine so that the ISR isn't
automatically placed in the interrupt vector table at link time but is
instead dynamically placed in the interrupt vector table at runtime
when the lwIP stack is initialized. Now the ethernet ISR is only linked
in when it is actually needed.

Example arm-none-eabi-size output for a simple LED blinking program
showing the before and after size results:
   text	   data	    bss	    dec	    hex	filename
  13208	    148	   7784	  21140	   5294	LPC1768/HelloWorld.elf

   text	   data	    bss	    dec	    hex	filename
  12700	    148	   7468	  20316	   4f5c	LPC1768/HelloWorld.elf
when false thread has empty link config
must join the network by commissioning
jeromecoutant and others added 23 commits July 11, 2017 08:44
Internal ADC pin are now out of PinMap_ADC array
1. added call to busReset() to KL25Z HAL; now the USB stack survives if you disconnect the cable, similar to LPC40 2. busReset callback to update terminal_connected in USBCDC 3. new bool USBSerial::connected() to read protected terminal_connected property, useful when you want to check if the terminal is ready from main app
Adding support for new platforms into official USB library
Minor change - List of key modifiers updated to include the
logo/GUI/windows key. Also added the options to specify the right hand
versions of the keys rather than just the left if for some reason
someone wants to do this.

Changes are limited to the keyboard header file and are backwards
compatible.

The new modifier values are in line with the table given on page 56 of
this document http://www.usb.org/developers/hidpage/HID1_11.pdf
Fixes #4196. As someone might not be aware that settting default_lib to small has
some implications regarding thread safety, therefore we print an error.
…RAM.

Allows mesh minimal example to compile with IAR.
Added the ability to specify a branch to update rather than a fork
Replaced print commands with the use of a logger
Updated the run_cmd functions in line with previous improvements
The function headers have been updated to follow the standard format
that should be being used for tools in mbed. This is a one line summary
followed by a descriptive block with more detail.
Updated the handling of the main function so that the logger becomes
global and thus works across all the functions. This has been tested
with both the fork and branch options, and for levels INFO and DEBUG.
Modifying the code for mbed ci shield test -> analogin_api.c, W7500x_adc.c, gpio_irq_api.c, W7500x_gpio.c
Modifying the code for fix bug -> W7500x_uart.c(register control driver problem), W7500x_uart.h, pinmap.c(pullup, pulldown problem)
- deleted dead code
- deleted test code
modified coding style. -> pinmap.c
PWM3 pin enable
@0xc0170
Copy link
Contributor

0xc0170 commented Jul 11, 2017

Thanks for the explanation. Something went wrong with the latest merge, please use rebase to be up to date with master.

@khj098765
Copy link
Contributor Author

My pull request information : master...Wiznet:master

base fork : ARMmbed/mbed-os
base : master
head fork : WIZnet/mbed-os

Is it wrong?
What should I do select base for rebase?

@theotherjimmy
Copy link
Contributor

@khj098765 It looks like you did a git merge after you did your rebase. This can happen if your git pull is set to merge (the default) and you follow the recommendation that git makes after you try to push after your rebase: it tells you to pull and merge first. Please don't pull and merge. We will ask you to rebase again. Instead, You should git push --force. This force push will throw away the old history (from before the rebase) and replace it with the new history (that you created with the rebase). Now you're in a tight spot: you have duplicate commits and a merge commit in the history. I think you might be able to get away with a quick bit of git-foo:

  1. Back up that branch! git checkout -b old-master
  2. Checkout the commit from after the rebase. I'm guessing that's going to be commit 482de93 so: git checkout 482de93
  3. Delete the branch named "master": git branch -D master
  4. Name the commit you're currently on as the new master: git checkout -b master
  5. Force push this new state to the remote (I'm guessing that your fork is named wiznet): git push --force -u wiznet

If that works, we should be able to resume development with the new master branch. Otherwise, you created a backup of the current state with the name "old-master" (supposing you followed my steps) that you can fall back on.

@khj098765
Copy link
Contributor Author

change pull request... #4745

@khj098765 khj098765 closed this Jul 12, 2017
@sg- sg- removed the needs: work label Jul 12, 2017
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.