[En-Nut-Discussion] A few patches

Krzysztof Sawicki krzysztof.sawicki at mlabs.pl
Tue Jan 10 10:05:21 CET 2017


Hi

- typo in I2C
- typo in linker script
- STM32 Can - some lines will never get executed

-- 
Krzysztof Sawicki
MLabs sp. z o.o.
ul. Kaliska 21
61-131 Poznań

tel. 61 646 84 27

KRS: 0000390306
NIP: 7822533401
-------------- next part --------------
Index: nut/arch/cm3/dev/stm/stm32_i2cbus_v1.c
===================================================================
--- stm32_i2cbus_v1.c	(revision 6574)
+++ stm32_i2cbus_v1.c	(working copy)
@@ -472,7 +472,7 @@
 static const STM32_I2C_HW i2c1_hw = {
     .icb_base = I2C1_BASE,
     .sda      = I2C1_SDA,
-    .scl_af   = I2C1_SDA_AF,
+    .sda_af   = I2C1_SDA_AF,
     .scl      = I2C1_SCL,
     .scl_af   = I2C1_SCL_AF,
     .smba     = I2C1_SMBA,
@@ -503,7 +503,7 @@
 static const STM32_I2C_HW i2c2_hw = {
     .icb_base = I2C2_BASE,
     .sda      = I2C2_SDA,
-    .scl_af   = I2C2_SDA_AF,
+    .sda_af   = I2C2_SDA_AF,
     .scl      = I2C2_SCL,
     .scl_af   = I2C2_SCL_AF,
     .smba     = I2C2_SMBA,
-------------- next part --------------
Index: nut/arch/cm3/dev/stm/stm32_can.c
===================================================================
--- stm32_can.c	(revision 6574)
+++ stm32_can.c	(working copy)
@@ -712,8 +712,10 @@
     CM3BB_OFFSETCLR(CANBBx, CAN_TypeDef, MCR, CAN_MCR_SLEEP);
     for(wait_ack = 0, rc = 1; (rc) && (wait_ack < SLAK_TimeOut); wait_ack++)
         rc  = CM3BB_OFFSETGET(CANBBx, CAN_TypeDef, MSR, CAN_MSR_SLAK);
-        return (rc == 0)?0:CAN_ERROR;
 
+    if (rc)
+    	return CAN_ERROR;
+
     /* We send tx mailboxes in chronological order and
        FOR NOW we don't retransmit on errer */
     CanSetFeatures( bus, CAN_TXFP | CAN_NART | CAN_ABOM , 1);
-------------- next part --------------
Index: nut/arch/cm3/ldscripts/stm32_ram.ld
===================================================================
--- stm32_ram.ld	(revision 6574)
+++ stm32_ram.ld	(working copy)
@@ -70,7 +70,7 @@
         PROVIDE_HIDDEN (__preinit_array_start = .);
         KEEP (*(.preinit_array*))
         PROVIDE_HIDDEN (__preinit_array_end = .);
-    } > FLASH0
+    } > SRAM0
 
     .init_array : {
         PROVIDE_HIDDEN (__init_array_start = .);
@@ -77,7 +77,7 @@
         KEEP (*(SORT(.init_array.*)))
         KEEP (*(.init_array*))
         PROVIDE_HIDDEN (__init_array_end = .);
-    } > FLASH0
+    } > SRAM0
 
     .fini_array : {
         PROVIDE_HIDDEN (__fini_array_start = .);
@@ -84,7 +84,7 @@
         KEEP (*(SORT(.fini_array.*)))
         KEEP (*(.fini_array*))
             PROVIDE_HIDDEN (__fini_array_end = .);
-    } > FLASH0
+    } > SRAM0
 
     _etext = .;
 


More information about the En-Nut-Discussion mailing list