summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-25 04:16:01 +0100
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-01-25 04:16:01 +0100
commit9a836f1dbf90f07c2fc4151166f7456879d675b0 (patch)
treebc7eec0850c1249c32465b41607a293c50eed44e
parentfcef19baed9cb5b040a3df0505e57710df20ee43 (diff)
Making the compiler a bitch by enabling warnings in full, fixing a few warnings, and making the board actually do slightly something.
-rw-r--r--arch/arm/lpc17xx/Drivers/source/lpc17xx_can.c4
-rw-r--r--arch/arm/lpc17xx/Drivers/source/lpc17xx_i2c.c4
-rw-r--r--arch/arm/lpc17xx/Drivers/source/lpc17xx_i2s.c2
-rw-r--r--arch/arm/lpc17xx/Drivers/source/lpc17xx_spi.c10
-rw-r--r--arch/arm/lpc17xx/Drivers/source/lpc17xx_ssp.c8
-rw-r--r--arch/arm/lpc17xx/Drivers/source/lpc17xx_timer.c2
-rw-r--r--arch/arm/lpc17xx/Drivers/source/lpc17xx_uart.c6
-rw-r--r--demo.c36
-rw-r--r--os/src/close.c1
-rw-r--r--os/src/free.c1
-rw-r--r--os/src/lseek.c1
-rw-r--r--os/src/sprintf.c2
-rw-r--r--os/src/write.c1
-rw-r--r--target-rules.mk2
14 files changed, 61 insertions, 19 deletions
diff --git a/arch/arm/lpc17xx/Drivers/source/lpc17xx_can.c b/arch/arm/lpc17xx/Drivers/source/lpc17xx_can.c
index eef871f..18cdce2 100644
--- a/arch/arm/lpc17xx/Drivers/source/lpc17xx_can.c
+++ b/arch/arm/lpc17xx/Drivers/source/lpc17xx_can.c
@@ -73,9 +73,9 @@ static void can_SetBaudrate (LPC_CAN_TypeDef *CANx, uint32_t baudrate);
static void can_SetBaudrate (LPC_CAN_TypeDef *CANx, uint32_t baudrate)
{
uint32_t result = 0;
- uint8_t NT, TSEG1, TSEG2;
+ uint8_t NT, TSEG1 = 0, TSEG2 = 0;
uint32_t CANPclk = 0;
- uint32_t BRP;
+ uint32_t BRP = 0;
CHECK_PARAM(PARAM_CANx(CANx));
if (CANx == LPC_CAN1)
diff --git a/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2c.c b/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2c.c
index 9b54228..c130ce1 100644
--- a/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2c.c
+++ b/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2c.c
@@ -211,7 +211,7 @@ static uint32_t I2C_GetByte (LPC_I2C_TypeDef *I2Cx, uint8_t *retdat, Bool ack)
***********************************************************************/
static void I2C_SetClock (LPC_I2C_TypeDef *I2Cx, uint32_t target_clock)
{
- uint32_t temp;
+ uint32_t temp = 0;
CHECK_PARAM(PARAM_I2Cx(I2Cx));
@@ -985,7 +985,7 @@ Status I2C_SlaveTransferData(LPC_I2C_TypeDef *I2Cx, I2C_S_SETUP_Type *TransferCf
{
uint8_t *txdat;
uint8_t *rxdat;
- uint32_t CodeStatus;
+ uint32_t CodeStatus = 0;
uint32_t timeout;
int32_t time_en;
int32_t tmp;
diff --git a/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2s.c b/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2s.c
index e151edb..085e963 100644
--- a/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2s.c
+++ b/arch/arm/lpc17xx/Drivers/source/lpc17xx_i2s.c
@@ -323,7 +323,7 @@ Status I2S_FreqConfig(LPC_I2S_TypeDef *I2Sx, uint32_t Freq, uint8_t TRMode) {
uint32_t x, y;
uint16_t dif;
uint16_t error;
- uint8_t x_divide, y_divide;
+ uint8_t x_divide = 0, y_divide = 0;
uint16_t ErrorOptimal = 0xFFFF;
CHECK_PARAM(PARAM_I2Sx(I2Sx));
diff --git a/arch/arm/lpc17xx/Drivers/source/lpc17xx_spi.c b/arch/arm/lpc17xx/Drivers/source/lpc17xx_spi.c
index 7643de7..77a0e51 100644
--- a/arch/arm/lpc17xx/Drivers/source/lpc17xx_spi.c
+++ b/arch/arm/lpc17xx/Drivers/source/lpc17xx_spi.c
@@ -215,11 +215,11 @@ uint16_t SPI_ReceiveData(LPC_SPI_TypeDef* SPIx)
int32_t SPI_ReadWrite (LPC_SPI_TypeDef *SPIx, SPI_DATA_SETUP_Type *dataCfg, \
SPI_TRANSFER_Type xfType)
{
- uint8_t *rdata8;
- uint8_t *wdata8;
- uint16_t *rdata16;
- uint16_t *wdata16;
- uint32_t stat;
+ uint8_t *rdata8 = NULL;
+ uint8_t *wdata8 = NULL;
+ uint16_t *rdata16 = NULL;
+ uint16_t *wdata16 = NULL;
+ uint32_t stat = 0;
uint32_t temp;
uint8_t dataword;
diff --git a/arch/arm/lpc17xx/Drivers/source/lpc17xx_ssp.c b/arch/arm/lpc17xx/Drivers/source/lpc17xx_ssp.c
index bbf03a6..7d6bb1d 100644
--- a/arch/arm/lpc17xx/Drivers/source/lpc17xx_ssp.c
+++ b/arch/arm/lpc17xx/Drivers/source/lpc17xx_ssp.c
@@ -339,10 +339,10 @@ uint16_t SSP_ReceiveData(LPC_SSP_TypeDef* SSPx)
int32_t SSP_ReadWrite (LPC_SSP_TypeDef *SSPx, SSP_DATA_SETUP_Type *dataCfg, \
SSP_TRANSFER_Type xfType)
{
- uint8_t *rdata8;
- uint8_t *wdata8;
- uint16_t *rdata16;
- uint16_t *wdata16;
+ uint8_t *rdata8 = 0;
+ uint8_t *wdata8 = 0;
+ uint16_t *rdata16 = 0;
+ uint16_t *wdata16 = 0;
uint32_t stat;
uint32_t tmp;
int32_t dataword;
diff --git a/arch/arm/lpc17xx/Drivers/source/lpc17xx_timer.c b/arch/arm/lpc17xx/Drivers/source/lpc17xx_timer.c
index 163cccd..8f8dc79 100644
--- a/arch/arm/lpc17xx/Drivers/source/lpc17xx_timer.c
+++ b/arch/arm/lpc17xx/Drivers/source/lpc17xx_timer.c
@@ -53,7 +53,7 @@ static uint32_t converPtrToTimeNum (LPC_TIM_TypeDef *TIMx);
**********************************************************************/
static uint32_t getPClock (uint32_t timernum)
{
- uint32_t clkdlycnt;
+ uint32_t clkdlycnt = 0;
switch (timernum)
{
case 0:
diff --git a/arch/arm/lpc17xx/Drivers/source/lpc17xx_uart.c b/arch/arm/lpc17xx/Drivers/source/lpc17xx_uart.c
index 5f4ee0c..da01cde 100644
--- a/arch/arm/lpc17xx/Drivers/source/lpc17xx_uart.c
+++ b/arch/arm/lpc17xx/Drivers/source/lpc17xx_uart.c
@@ -60,7 +60,7 @@ static Status uart_set_divisors(LPC_UART_TypeDef *UARTx, uint32_t baudrate)
{
Status errorStatus = ERROR;
- uint32_t uClk;
+ uint32_t uClk = 0;
uint32_t calcBaudrate = 0;
uint32_t temp = 0;
@@ -668,7 +668,7 @@ void UART_ForceBreak(LPC_UART_TypeDef* UARTx)
*********************************************************************/
void UART_IntConfig(LPC_UART_TypeDef *UARTx, UART_INT_Type UARTIntCfg, FunctionalState NewState)
{
- uint32_t tmp;
+ uint32_t tmp = 0;
CHECK_PARAM(PARAM_UARTx(UARTx));
CHECK_PARAM(PARAM_FUNCTIONALSTATE(NewState));
@@ -1158,7 +1158,7 @@ void UART_FullModemForcePinState(LPC_UART1_TypeDef *UARTx, UART_MODEM_PIN_Type P
void UART_FullModemConfigMode(LPC_UART1_TypeDef *UARTx, UART_MODEM_MODE_Type Mode, \
FunctionalState NewState)
{
- uint8_t tmp;
+ uint8_t tmp = 0;
CHECK_PARAM(PARAM_UART1_MODEM(UARTx));
CHECK_PARAM(PARAM_UART1_MODEM_MODE(Mode));
diff --git a/demo.c b/demo.c
index 7f2a174..5fe57cb 100644
--- a/demo.c
+++ b/demo.c
@@ -1,6 +1,42 @@
#include <FreeRTOS.h>
#include <task.h>
+#include <debug_frmwrk.h>
+#include <lpc17xx_gpio.h>
+
+#define LED1_wire 18
+#define LED2_wire 20
+#define LED3_wire 21
+#define LED4_wire 23
+
+static void setupLEDs() {
+ GPIO_SetDir(1, (1 << LED1_wire) | (1 << LED2_wire) | (1 << LED3_wire) | (1 << LED4_wire), 1);
+}
+
+void litLED(int led, int value) {
+ if ((led >= 4) || (led < 0))
+ return;
+
+ switch (led) {
+ case 1: led = LED1_wire; break;
+ case 2: led = LED2_wire; break;
+ case 3: led = LED3_wire; break;
+ case 4: led = LED4_wire; break;
+ }
+
+ if (value) {
+ GPIO_SetValue(1, led);
+ } else {
+ GPIO_ClearValue(1, led);
+ }
+}
int main() {
+ debug_frmwrk_init();
+ setupLEDs();
+ litLED(1, 1);
+ litLED(2, 0);
+ litLED(3, 1);
+ litLED(4, 0);
vTaskStartScheduler();
+ return 0;
}
diff --git a/os/src/close.c b/os/src/close.c
index 46ee8c5..ae0716f 100644
--- a/os/src/close.c
+++ b/os/src/close.c
@@ -1,4 +1,5 @@
#include <reent.h>
int _close_r(struct _reent * reent, int fd) {
+ return 0;
}
diff --git a/os/src/free.c b/os/src/free.c
index f2d1fe5..d80aff2 100644
--- a/os/src/free.c
+++ b/os/src/free.c
@@ -1,4 +1,5 @@
#include <reent.h>
+#include <malloc.h>
void free(void * ptr) {
_free_r(_impure_ptr, ptr);
diff --git a/os/src/lseek.c b/os/src/lseek.c
index 1b86dbb..f132693 100644
--- a/os/src/lseek.c
+++ b/os/src/lseek.c
@@ -1,4 +1,5 @@
#include <reent.h>
_off_t _lseek_r(struct _reent * reent, int fd, _off_t seek, int wheel) {
+ return 0;
}
diff --git a/os/src/sprintf.c b/os/src/sprintf.c
index 76ea9a2..30d27b3 100644
--- a/os/src/sprintf.c
+++ b/os/src/sprintf.c
@@ -1,4 +1,5 @@
#include <reent.h>
+#include <stdio.h>
#include <stdarg.h>
int sprintf(char * str, const char * fmt, ...) {
@@ -7,4 +8,5 @@ int sprintf(char * str, const char * fmt, ...) {
va_start(ap, fmt);
r = _vsprintf_r(_impure_ptr, str, fmt, ap);
va_end(ap);
+ return r;
}
diff --git a/os/src/write.c b/os/src/write.c
index a1bf474..a54195f 100644
--- a/os/src/write.c
+++ b/os/src/write.c
@@ -1,4 +1,5 @@
#include <reent.h>
_ssize_t _write_r(struct _reent * reent, int fd, const void * buf, size_t size) {
+ return 0;
}
diff --git a/target-rules.mk b/target-rules.mk
index 1edcc7a..6a608f6 100644
--- a/target-rules.mk
+++ b/target-rules.mk
@@ -1,6 +1,6 @@
%.o: %.c
$(E) "[TC] Compiling $<"
- $(Q)$(TARGET_CC) $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CPPFLAGS) -c -o $@ $<
+ $(Q)$(TARGET_CC) -ffunction-sections -Wall -Werror $(addprefix -I, $(TARGET_INCLUDES)) $(TARGET_CPPFLAGS) -c -o $@ $<
%.o: %.s
$(E) "[TS] Compiling $<"