Commit Graph

1324 Commits

Author SHA1 Message Date
Brian Swetland
32aa1faca5 [lib][lwip] fix warning
In file included from lk/lib/lwip/include/lwip/netif.h:41:0,
                 from lk/lib/lwip/include/lwip/udp.h:40,
                 from lk/lib/lwip/core/dhcp.c:75:
lk/lib/lwip/core/dhcp.c: In function ‘dhcp_bind’:
lk/lib/lwip/include/ipv4/lwip/ip_addr.h:200:39: warning: the comparison will always evaluate as ‘false’ for the address of ‘gw_addr’ will never be NULL [-Waddress]
 #define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == IPADDR_ANY)
                                       ^
lk/lib/lwip/core/dhcp.c:987:7: note: in expansion of macro ‘ip_addr_isany’
   if (ip_addr_isany(&gw_addr)) {
       ^
2015-06-26 16:42:18 -07:00
Brian Swetland
6f80387b3d [lib][lwip] fix warning
In file included from lk/lib/lwip/include/ipv4/lwip/ip.h:39:0,
                 from lk/lib/lwip/core/ipv4/ip.c:42:
lk/lib/lwip/core/ipv4/ip.c: In function ‘ip_input’:
lk/lib/lwip/include/ipv4/lwip/ip_addr.h:200:39: warning: the comparison will always evaluate as ‘false’ for the address of ‘current_iphdr_src’ will never be NULL [-Waddress]
 #define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == IPADDR_ANY)
                                       ^
lk/lib/lwip/core/ipv4/ip.c:473:24: note: in expansion of macro ‘ip_addr_isany’
   if (check_ip_src && !ip_addr_isany(&current_iphdr_src))
                        ^
2015-06-26 16:40:26 -07:00
Brian Swetland
d3821c6063 [lib][lwip] C++11 is more particular about spaces near constant strings 2015-06-26 15:18:51 -07:00
Brian Swetland
bf178448c5 [build] __BEGIN/__END_CDECLS around many headers 2015-06-26 13:39:37 -07:00
Brian Swetland
3729d00f00 [lib][minip] fix build on non-zynq platforms 2015-06-25 17:49:38 -07:00
Brian Swetland
6fee28f6b6 [lib][heap] make header c++ safe 2015-06-24 16:12:35 -07:00
Brian Swetland
ecf9925ff6 [platform][stm32f4xx] provide overrides for PLL init values 2015-06-23 20:00:17 -07:00
Brian Swetland
acf7a49c4f [platform][stm32f4xx] based on stm32f2xx platform
Quick first pass at stm32f4xx support using the latest STM32F4
peripheral library code.  Probably could (and should) share more
with stm32fxxx.
2015-06-19 18:49:08 -07:00
Brian Swetland
3644293ed7 [platform][stm32f4xx] adjust header for lk integration 2015-06-19 18:49:08 -07:00
Brian Swetland
60a15dbc52 [platform][stm32f4xx] Import STM32F4xx StdPeriph Lib v1.5.1 2015-06-19 18:49:08 -07:00
Travis Geiselbrecht
e0495b6b55 [lib][debug] reduce the scope of the locking around debug output
-Reduce the spinlock scope to just around the individual registered
output routine, and leave platform_dputc() call unlocked. This helps
to keep interrupts disabled for the minimum amount of time, especially
with a slow platform_dputc, at the expense of printfs being more interleaved
between cpus than before.
-The general solution to the interleaving is to use a user space mutex around
printing to any given descriptor, and handle printfing from irq-disabled state
by either not locking at all, or using a different, direct path.
2015-06-19 16:05:28 -07:00
Travis Geiselbrecht
f45b123db0 [platform][zynq] save the reboot status register and clear reason bits
Pretty print the reason bits.
2015-06-19 15:36:56 -07:00
Travis Geiselbrecht
b8870a3c43 [arch][arm] in order to be backwards compatible, continue to try to use TOOLCHAIN_PREFIX
If ARCH_arm_TOOLCHAIN_PREFIX isn't already set, try to use whatever is
in TOOLCHAIN_PREFIX first, before trying to use the path. This is for
compatibility with the top level makefile which currently still only
passes TOOLCHAIN_PREFIX along to the submakefiles.

Change-Id: Ib883c9c9de220df5191ee001b18c4a9eff3192c2
2015-06-16 18:37:43 -07:00
Travis Geiselbrecht
de66cda97b [project][stm32f4-discovery-test] inheirit -test part of project from shared test.mk
Change-Id: I48de75dd048327f2160356d5f60a8386ea9944e3
2015-06-16 18:12:20 -07:00
Nathaniel Quillin
6243633389 [lib][minip] add string utility for parsing ip addresses
Change-Id: If8270c7b48a63e4bddbad7754213e974c29b8744
2015-06-16 18:12:20 -07:00
Brian Swetland
1060f479b0 [projects][stm32f4-discovery] make a note of where the UART is 2015-06-11 15:28:31 -07:00
Travis Geiselbrecht
a7cf45aad7 [arch][arm-m] fix cortex-m code post SMP
At the top of each irq handler, make sure PRIMASK is set to 1, so
that arch_ints_disabled(), which is now used by the spinlock code,
returns the appropriate value. On Cortex-M this is not exactly the
same thing as having irqs disabled, but it's the easiest thing to
query as long as the model of only having one level of irq handler
is maintained.
2015-06-03 17:44:46 -07:00
Arve Hjønnevåg
bd052a3507 [arch][arm64] Fix fiq support
Enable fiqs at boot, and during exceptions that can trigger a
context switch.

This fixes two problems. It avoids deadlock in code that uses spinlocks
with fiqs enabled as one cpu could be holding that spinlock and get
interrupted by an fiq, while another cpu is blocked trying to lock that
spinlock with fiqs disabled. This deadlocks if the fiq is delivered to
both these cpus and the second cpu is responsible to clearing the
interrupt.

Also, since thread_preempt can return with fiqs enabled,
regrestore_short could get interrupted by an fiq which would then
corrupt elr_el1 and spsr_el1.

Change-Id: I427f39ff94514866bf87f48393d145b7f1723502
2015-06-03 15:58:55 -07:00
Travis Geiselbrecht
586fe3d831 [include][trace] move LTRACEF_LEVEL out of timer code into generic header
Seems useful enough.
2015-06-02 21:11:51 -07:00
Travis Geiselbrecht
785b7e4f77 [project] factor out common -test project config into a separate project file 2015-06-02 21:06:19 -07:00
Travis Geiselbrecht
842cb7a7ae [warnings] fix warnings post-smp
Most of the warnings are printf related due to lk_time_t now being defined as an
unsigned int instead of unsigned long.
2015-06-02 21:03:05 -07:00
Travis Geiselbrecht
5f16c6e93b [arch][arm] change conditional to only cover waiting for secondary cpus
Instead of conditionalizing arch code booting secondaries, only conditionalize
waiting for each of them to come up.

This should be semi-temporary, as the need to wait will go away once arm
switches entirely to the trampoline page table strategy.

Change-Id: Idbdb9720bfac58adf514b7fa137e59aee413f4df
2015-06-02 13:39:15 -07:00
Travis Geiselbrecht
bb15480a66 [platform][zynq][gem] hold the gem spinlock across the entire irq handler
Change-Id: Ifc88db88f60e1f6381a9d7195cfea6bffa02fa7a
2015-06-01 19:08:11 -07:00
Travis Geiselbrecht
2362022970 [arch][arm] conditionalize the code to boot the secondary cpus in arch_init()
On some platforms, the secondary cpus have been booted and trapped by the arch/arm code
and need to be brought up lockstep to make sure the temporary page mappings are
still in place as they are booted. For these platforms, set
ARM_ARCH_BOOTS_SECONDARIES=1 to have arch_init() try to release and start the cpus.

For other platforms, after arch_init() they can simply arrange for the secondary cpus
to start themselves.

Change-Id: I7619ac66d84bd26060ddd949ae6641c1ef6e2b1d
2015-06-01 18:35:25 -07:00
Travis Geiselbrecht
22704a793c [arch][arm] reset the ACTLR back to a default state for cortex-a9 prior to chain loading
This seems to fix some cache coherency problems with chain loading, most likely
related to the L2 cache bits in the ACTLR.

Change-Id: I0b14a71334fd1db737d6146db8745b26cfd51d97
2015-06-01 15:46:46 -07:00
Travis Geiselbrecht
f76c4a4541 [project][uzed-bootloader] disable SMP for this project
chainloading from SMP environment currently doesn't work properly.

Change-Id: Iaed1fc92f0269c38522a420be972d957a13aebc4
2015-06-01 15:29:06 -07:00
Travis Geiselbrecht
6304f4a8e8 [lib][libc] add simple errno implementation
Completely un-threadsafe, but enough to satisfy the __geterrno extern.

Change-Id: I95b23f381767a3d55f43d77c188cb0cd611536ee
2015-05-29 15:46:32 -07:00
Travis Geiselbrecht
02b5def157 [init] don't print init trace messages earlier than a particular level
Really to work around an arch specific problem on a particular platform, but
potentially useful elsewhere.

Change-Id: Ifae6f11cc78be8623eb0746338e18383863a4827
2015-05-29 15:37:25 -07:00
Travis Geiselbrecht
1c20be789f [arch][arm] make sure all cpus have the same TTBR secondary bits loaded
Change-Id: Ie011621e72a0fa8d1fe43e6614ca376e1db5cbb7
2015-05-29 15:34:30 -07:00
Travis Geiselbrecht
781405aa87 [app][tests] add realtime arg to the spinner command
Change-Id: I07feb8c66de06fc99730b6795b0442dd9dd7b982
2015-05-29 15:27:58 -07:00
Travis Geiselbrecht
5635ef811d [platform][zynq] fix double acquire of spinlock
Change-Id: Ia0ac5e1e2cdc51d616676b7fd34f1976b171a01e
2015-05-29 15:18:52 -07:00
Travis Geiselbrecht
f1f57fb591 [lib][cbuf|watchdog] fix post smp spinlock code
Change-Id: I702c01539798daa5f5fb71c98a88a3c9c3fb86b2
2015-05-28 13:00:41 -07:00
Travis Geiselbrecht
96ba54f187 [merge] merge back from smp branch 2015-05-28 12:52:41 -07:00
Travis Geiselbrecht
056b30bfe7 [app][lkboot] ask platform code if we should autoboot before booting
-have the zynq nak autobooting if the BOOT_MODE pins were set to
JTAG mode.
-Clean up some of the timeout logic a bit.

Change-Id: I4ace6354de89f2e88aa270e5ebc1bf01ebe3b046
2015-05-20 23:31:39 -07:00
Travis Geiselbrecht
f13ebc12f5 [platform][zynq] add code to read the BOOT_MODE pins sampled at power on
Change-Id: I2745b4aa5d63f1f8d6630836fec88ae0577feb7d
2015-05-20 23:31:39 -07:00
Travis Geiselbrecht
307628f29b [platform][zynq] add watchdog driver
-use lib/watchdog to manage the hardware watchdog driver
-set the default timeout to 1 second, pet at 500ms intervals

Change-Id: I04d23313083e4715791e197d4a50f319df9916aa
2015-05-20 23:31:39 -07:00
Nathaniel Quillin
4af4bb5a83 [lib][minip] moved udp to its own file
Change-Id: I2467d850110db14ebbf5c4ac68a835818f664246
2015-05-20 22:15:56 +00:00
Travis Geiselbrecht
fada1c63ca [app][lkboot] remove printf warning
Change-Id: Ibee4aa7fec25ccb2a5c91fb4e3d6bc87ed0231c0
2015-05-20 14:25:37 -07:00
Arve Hjønnevåg
2abb81c86e [arch][arm] Disable interrupts in arm_vtop
If a thread moved to another cpu between arm_write_ats1cpr and
arm_read_par, the pa returned will not be for the va passed in.

Change-Id: I19cbbcef09c85a7ae1d2d5122ad3f10a2282855e
2015-05-19 16:38:22 -07:00
Arve Hjønnevåg
beac54d1f5 [arch][arm][mmu] Check the result of arm_vtop
Change-Id: I3a88f45651635e6adfbe0b38f2b395c06cbe6f79
2015-05-19 16:37:17 -07:00
John Grossman
9fd7aede55 [i2c] Add a generic bit-banged i2c implementation.
Change-Id: I3bf9b2022342e4452c525dca940ca46088b27445
Signed-off-by: John Grossman <johngro@google.com>
2015-05-19 16:31:15 -07:00
John Grossman
fc44d8d651 [dev][i2c] Update the LK I2C interface.
Update the existing LK I2C driver interface to do a few different things.
1) Return status_t's from the driver operations, instead of just ints.
2) Add the ability to read/write multi-byte registers from I2C
   devices.
3) Add a comment clarifying the use of 7-bit addresses with this API.

Also, bring existing platform implementations into line with these
changes.

Change-Id: Ie28afed28094cbab6d68266bdf37d7dc8d309366
Signed-off-by: John Grossman <johngro@google.com>
2015-05-19 16:28:28 -07:00
John Grossman
5f804f25fc [lk][arch] Add spin_cycles
Add an architecture specific function which spins for a specific
number of CPU cycles.  Currently implemented for ARM-M only.

Change-Id: Idbf2a83186cf5ffa239d644dc732fe3d419431c1
Signed-off-by: John Grossman <johngro@google.com>
2015-05-19 16:28:07 -07:00
John Grossman
c2b645ef8a [zynq][gpio] Fix a collection of bugs with the GPIO driver.
+ When setting GPIOs, the MASK_DATA registers are used.  Code was
  properly computing which register to use based on register index
  (either LSW or MSW), but was improperly computing the mask/value to
  set when the GPIO to be manipulated existed in the upper 16 bits
  (the shift needed to be offset by 16 bits and was not).
+ Do not manipulate things like the IO driver type, drive speed, and
  so on when enabling/disabling the pullup in the SLCR registers.
  Previously, whenever a GPIO was being configured, the SLCR register
  was being set to be 1.8v LVCMOS, and having the DISABLE RCV bit set.
  Things like the IO type have been set by the platform and should not
  be manipulated by the GPIO driver.  Now, the GPIO code leaves those
  bits the way they were configured, and changes only the PULLUP bit
  as well as the 4 levels mux bits (arguably, it should not even
  change the mux bits; it is the platform's job to properly mux the
  pins).
+ Address an issue with the subtle (undocumented) difference between
  the DIRM and the OEN bits when configuring for input vs. output.
  Please read the extensive comment in the code for details.

Change-Id: I160069eeef92b1cf0763274ccb64c5d14744f563
Signed-off-by: John Grossman <johngro@google.com>
2015-05-19 10:21:33 -07:00
Arve Hjønnevåg
2c9c5959e7 Merge branch 'master' of https://github.com/travisg/lk into smp
Change-Id: Iecb11d57b6f089234c0826932bdb229588939750
2015-05-18 16:49:37 -07:00
Michael Ryleev
0e55675afe [make] Update MAKECONFIGHEADER macro (round 2)
Add "c++" => "cpp" and "C++" to "CPP" translation
to inclusion guard portion of config.h

Change-Id: Id1c15209427e8e6054a85bf2e091a47b7b5a1c00
2015-05-18 16:15:51 -07:00
John Grossman
1f2e62da4d [zynq][gpio] Fix a typo in the GPIO code.
Fix an issue with the GPIO code where it was dividing by 31 instead of
32 when attempting to map GPIO numbers to bank IDs.

Change-Id: I986eac1f9dce119445d1611666b61a7b2635ca5b
Signed-off-by: John Grossman <johngro@google.com>
2015-05-18 14:42:51 -07:00
Arve Hjønnevåg
1227165423 [arch][arm64] Reduce stack size
Change-Id: I3a4457d62d545aafb58dd6adf95982e010a997b4
2015-05-13 20:40:07 -07:00
Michael Ryleev
1675485aa8 [make] Update MAKECONFIGHEADER macro
Add "C++" => "CPP" translation to support libraries
having "c++" in their names, for example libstdc++.
Without such translation, resulting #define does not
compile.

Change-Id: Ieac533782a26b4ce87caf9ad2ec1105c25eeaf01
2015-05-13 20:40:06 -07:00
Arve Hjønnevåg
b4aaff6ebd [arch][arm64][mmu] Add barrier in map
Fixes random crashes on Cortex-A53

Change-Id: Id3d5c8347dbc4389784e522d083e7658070edce4
2015-05-13 20:21:08 -07:00