Photon CAN Bus [Completed]

Writing CAN
Reading CAN
Read CAN
ID = 533200891 1
Len = 15
Data = 223, 255, 63, 254, 223, 255, 63, 254

0xfb 0xff 0xc7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xef 0xc9 0xc7 0xe9 0xe4
0xfb 0xff 0xc7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xef 0xc9 0xc7 0xe9 0xe4
0xfb 0xff 0xc7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xef 0xc9 0xc7 0xe9 0xe4

Where are you getting this data from? Is this what another device is receiving? What is the CAN ID, Data Length, Data Bytes?

The CAN driver is currently hard coded to transmit the following message"
Extended ID=0x1234, No RTR, 8 Data bytes, Data= 1, 2, 3, 4, 5, 6, 7, 8

I made a change to the transmit so that it will actually try to send the message that is in the application.

I also put the check for pending message in on the receive side. This will remove the “bad” message from being printed to the serial terminal. I think


So pull the latest changes and see if it helps with anything. I don’t think it really will but it is more true to the final implementation.

Writing CAN
Writing CAN
Writing CAN
Writing CAN
Writing CAN

0xfb 0xff 0xe7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xdd 0xc9 0xc7 0xe9 0xe4
0xfb 0xff 0xe7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xdd 0xc9 0xc7 0xe9 0xe4
0xfb 0xff 0xe7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xdd 0xc9 0xc7 0xe9 0xe4
0xfb 0xff 0xe7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xdd 0xc9 0xc7 0xe9 0xe4
0xfb 0xff 0xe7 0x1f 0x01 0x0f 0x00 0x00 0x48 0xcb 0x72 0xdd 0xc9 0xc7 0xe9 0xe4

Do you know if this is interpreted as:

ID 0x1FE7FFFB data length 1 data 0x0F

This is what I had been receiving:

I would really like to understand if we are getting the same data, but I don't understand what format your is in.

I imagine that they are the same, I turned off the formatting I was using for my data was just dumping your data as serial bytes. You apparently need to swap the byte order like 3,2,1, 0 to get a 32 bit number instead of 0, 1, 2, 3. You might want to get a Teensy 3.2 and try the FlexCan library example which is what I’m using at 1Mb.

void hexDump(uint8_t dumpLen, uint8_t *bytePtr) {

BUFFER[0] = '\0';

/*
sprintf(BUFFER, "0x%02x%02x 0x%02x%02x 0x%02x 0x%02x 0x%02x%02x ",
                 bytePtr[3], bytePtr[2], bytePtr[1], bytePtr[0],
                 bytePtr[4], bytePtr[5], bytePtr[7], bytePtr[6]);

dumpLen -= 8;

int length = (bytePtr[5] < dumpLen) ? bytePtr[5] : dumpLen;

bytePtr += 8;

while (length--) {        
    sprintf(TEMP_BUFFER, "0x%02x ", *bytePtr++);
    strcat(BUFFER, TEMP_BUFFER);
}

*/

while (dumpLen--) {        
    sprintf(TEMP_BUFFER, "0x%02x ", *bytePtr++);
    strcat(BUFFER, TEMP_BUFFER);
}

strcat(BUFFER, "\r\n");    
Serial.print(BUFFER);

}

I was able to fix the problem with not being able to do a make in the modules directory. I bought an old spark/photon JTAG shield and standalone STLINK/V2 debugger. I am able to connect to the photon from openocd or st-link but I haven’t been able to get breakpoints to work. Going into DFU mode, starting openocd, and then “monitor reset halt”. seems to halt the CPU but setting a breakpoint and then hitting c from gdb causes openocd to get disconnected. I was also able to download the most recent firmware and merge in your changes, but while I’m able to send can packets from the photon to the teensy, they are the same as before.

WOULD IT BE POSSIBLE TO GET SOMEONE FROM PARTICLE TO LOOK AT THIS AND ALSO TELL ME WHEN I WILL BE ABLE TO BUY A NEW PROGRAMMER SHIELD?

Take a look at my article about using the debugger. This should help you figure out what you are missing. Probably you need to compile the firmware with debugger support turned on.

I did read your article and it was very helpful, however I’m still having problems. The application was using D7 and just disabled it, please see below.

^C and then c suspends and resumes application but it doesn’t break on breakpoints 


(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x08025072 in SparkProtocol::set_key (this=0x200018a0, signed_encrypted_credentials=0xa5a5a5a5 “”) at src/spark_protocol.cpp:1608
1608 calculate_ciphertext_hmac(signed_encrypted_credentials, credentials, hmac);
(gdb) b applications/can/application.cpp:75
Breakpoint 3 at 0x80a0280: file applications/can/application.cpp, line 75.
(gdb) c
Continuing.


cd modules

make clean all -s PLATFORM=photon COMPILE_LTO=n APP=can MODULAR=n PARTICLE_DEVELOP=1 program-dfu USE_SWD_JTAG=y DEBUG_BUILD=y


~/Downloads/particle/scripts/sync_20152012.bash

#!/bin/bash -v

READELF=arm-none-eabi-readelf
GDB=arm-none-eabi-gdb
COMMON_BUILD=~/Downloads/particle/20151220/firmware/build
PLATFORM_ID=6
LTO=

function elf {
echo $COMMON_BUILD/target/$1/platform-$PLATFORM_ID-m$LTO/$1.elf
}

SYSTEM_PART1_ELF=$(elf system-part1)
elf system-part1
SYSTEM_PART2_ELF=$(elf system-part2)
elf system-part2
USER_PART_ELF=/home/randal/Downloads/particle/20151220/firmware/build/target/user-part/platform-6-m/can.elf

function text_section_address {
$READELF $1 --headers | grep .text | head -n 1 | sed “s/.PROGBITS \([^ ]\)./0x\1/”
}

SYSTEM_PART1_ADDRESS=$(text_section_address $SYSTEM_PART1_ELF)
text_section_address $SYSTEM_PART1_ELF
SYSTEM_PART2_ADDRESS=$(text_section_address $SYSTEM_PART2_ELF)
text_section_address $SYSTEM_PART2_ELF
USER_PART_ADDRESS=$(text_section_address $USER_PART_ELF)
text_section_address $USER_PART_ELF

$GDB
-ex “target remote localhost:4242”
-ex “set confirm off”
-ex “add-symbol-file $SYSTEM_PART1_ELF $SYSTEM_PART1_ADDRESS”
-ex “add-symbol-file $SYSTEM_PART2_ELF $SYSTEM_PART2_ADDRESS”
-ex “add-symbol-file $USER_PART_ELF $USER_PART_ADDRESS”
-ex “set confirm on” \

GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Copyright © 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and “show warranty” for details.
This GDB was configured as “–host=x86_64-unknown-linux-gnu --target=arm-none-eabi”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type “help”.
Type “apropos word” to search for commands related to “word”.
Remote debugging using localhost:4242
0x00000000 in ?? ()
add symbol table from file “/home/randal/Downloads/particle/20151220/firmware/build/target/system-part1/platform-6-m/system-part1.elf” at
.text_addr = 0x80201b0
Reading symbols from /home/randal/Downloads/particle/20151220/firmware/build/target/system-part1/platform-6-m/system-part1.elf
done.
add symbol table from file “/home/randal/Downloads/particle/20151220/firmware/build/target/system-part2/platform-6-m/system-part2.elf” at
.text_addr = 0x80601d8
Reading symbols from /home/randal/Downloads/particle/20151220/firmware/build/target/system-part2/platform-6-m/system-part2.elf
done.
add symbol table from file “/home/randal/Downloads/particle/20151220/firmware/build/target/user-part/platform-6-m/can.elf” at
.text_addr = 0x80a0018
Reading symbols from /home/randal/Downloads/particle/20151220/firmware/build/target/user-part/platform-6-m/can.elf
done.
(gdb) b loop
Breakpoint 1 at 0x8060554: loop. (2 locations)
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y
1.1 y 0x08060554 in loop() at 
/
/
/modules/shared/stm32f2xx/inc/system_part2_loader.c:64
1.2 y 0x080a0200 in loop() at applications/can/application.cpp:52
(gdb) disable 1.1
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
^C
Program received signal SIGINT, Interrupt.
0x08025072 in SparkProtocol::set_key (this=0x200018a0, signed_encrypted_credentials=0xa5a5a5a5 “”) at src/spark_protocol.cpp:1608
1608 calculate_ciphertext_hmac(signed_encrypted_credentials, credentials, hmac);
(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08002e2c msp: 0x20020000
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y
1.1 n 0x08060554 in loop() at 
/
/
/modules/shared/stm32f2xx/inc/system_part2_loader.c:64
1.2 y 0x080a0200 in loop() at applications/can/application.cpp:52
(gdb) c
Continuing.


openocd -s ~/EmbeddedArm/openocd-bin/share/openocd/scripts/ -f board/photon.cfg
-c “gdb_port 4242” -c "$_TARGETNAME configure -rtos FreeRTOS"
Open On-Chip Debugger 0.9.0 (2015-12-19-11:23)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport “hla_swd”. To override use 'transport select '.
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.253438
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting ‘gdb’ connection on tcp/4242
Info : device id = 0x20036411
Info : flash size = 1024kbytes
undefined debug reason 7 - target needs reset
Warn : RTOS FreeRTOS not detected. (GDB could not find symbol ‘pxCurrentTCB’)
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08002e2c msp: 0x20020000
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
Info : dropped ‘gdb’ connection
Info : accepting ‘gdb’ connection on tcp/4242
Warn : RTOS FreeRTOS not detected. (GDB could not find symbol ‘pxCurrentTCB’)
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08002e2c msp: 0x20020000
Error: Error allocating memory for -1291820781 threads
Error: Error allocating memory for -1291820781 threads

I think the main issue is the mix of modular and non modular configurations.

For debugger use, I always use the non-modular firmware now. You get one ELF file and it’s just simpler. I got tired of the multiple symbols for main, loop, setup, etc in the 3 modular firmware ELF files.

So make sure you compile from main not modules with MODULAR=n. After you are done debugging, recompile and flash from modules with MODULAR=y to make sure you can use the cloud compiler later.

cd main
make clean all program-dfu APP=can PARTICLE_DEVELOP=1 PLATFORM=photon USE_SWD_JTAG=y MODULAR=n

DEBUG_BUILD=y isn’t necessary unless you really need it. I’ve never set the COMPILE_LTO option so the default should be sufficient.

The openocd command looks OK. Starting openocd with OS support -c "\$_TARGETNAME configure -rtos FreeRTOS" is only necessary if you want to debug threading issues.

Since you use non-modular firmware, just load main.elf in gdb.

arm-none-eabi-gdb -ex "target remote localhost:4242" ../build/target/main/platform-6-m/main.elf
1 Like

Thanks, the breakpoints are working now.

1 Like

It looks like it is passing the correct data to CAN_Transmit but something is going wrong with the CANx->sTxMailBox[transmit_mailbox].TDLR & CANx->sTxMailBox[transmit_mailbox].TDHR.


57        
58        CAN_Message_Struct Message;
59        
60        Message.Ext = true;
61        Message.ID = 0x1234UL;
62        Message.rtr = false;
63        Message.Len = 8U;
64        Message.Data[0]='h';
65        Message.Data[1]='e';
66        Message.Data[2]='l';
67        Message.Data[3]='l';
68        Message.Data[4]='o';
69        Message.Data[5]=' ';
70        Message.Data[6]='W';
71        Message.Data[7]='!';
72        Serial.println("Writing CAN");
73        delay(500);
74        //digitalWrite(led2, HIGH);
75        Can1.write(&Message);    

623 571 /**
572 * @brief Initiates and transmits a CAN frame message.
573 * @param CANx: where x can be 1 or 2 to to select the CAN peripheral.
574 * @param TxMessage: pointer to a structure which contains CAN Id, CAN DLC and CAN data.
575 * @retval The number of the mailbox that is used for transmission or
576 * CAN_TxStatus_NoMailBox if there is no empty mailbox.
577 /
578 uint8_t CAN_Transmit(CAN_TypeDef
CANx, CanTxMsg* TxMessage)
579 {
580 uint8_t transmit_mailbox = 0;
581 /* Check the parameters /
582 assert_param(IS_CAN_ALL_PERIPH(CANx));
583 assert_param(IS_CAN_IDTYPE(TxMessage->IDE));
584 assert_param(IS_CAN_RTR(TxMessage->RTR));
585 assert_param(IS_CAN_DLC(TxMessage->DLC));
586


623 /
Set up the DLC /
624 TxMessage->DLC &= (uint8_t)0x0000000F;
625 CANx->sTxMailBox[transmit_mailbox].TDTR &= (uint32_t)0xFFFFFFF0;
626 CANx->sTxMailBox[transmit_mailbox].TDTR |= TxMessage->DLC;
627
628 /
Set up the data field /
629 CANx->sTxMailBox[transmit_mailbox].TDLR = (((uint32_t)TxMessage->Data[3] << 24) |
630 ((uint32_t)TxMessage->Data[2] << 16) |
631 ((uint32_t)TxMessage->Data[1] << 8) |
632 ((uint32_t)TxMessage->Data[0]));
633 CANx->sTxMailBox[transmit_mailbox].TDHR = (((uint32_t)TxMessage->Data[7] << 24) |
634 ((uint32_t)TxMessage->Data[6] << 16) |
635 ((uint32_t)TxMessage->Data[5] << 8) |
636 ((uint32_t)TxMessage->Data[4]));
637 /
Request transmission */
638 CANx->sTxMailBox[transmit_mailbox].TIR |= TMIDxR_TXRQ;
639 }
640 return transmit_mailbox;
641 }
642


(gdb) b CAN_Transmit
Breakpoint 1 at 0x8020efc: file WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c, line 582.
(gdb)
(gdb) p TxMessage->Data[0]
$9 = 104 ‘h’
(gdb) p TxMessage->Data[1]
$10 = 101 ‘e’
(gdb) p TxMessage->Data[2]
$11 = 108 ‘l’
(gdb) p TxMessage->Data[3]
$12 = 108 ‘l’
(gdb) p TxMessage->Data[4]
$13 = 111 ‘o’
(gdb) p TxMessage->Data[5]
$14 = 32 ’ '
(gdb) p TxMessage->Data[6]
$15 = 87 ‘W’
(gdb) p TxMessage->Data[7]
$16 = 33 ‘!’
(gdb) p TxMessage->Data[8]
$17 = 165 ‘\245’
(gdb) p CANx->sTxMailBox[transmit_mailbox].TDLR
$18 = 4265607135
(gdb) p CANx->sTxMailBox[transmit_mailbox].TDHR
$19 = 4265607135
(gdb) p transmit_mailbox
$20 = 0 ‘\000’
(gdb) b WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c:629
Breakpoint 2 at 0x8020f9e: file WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c, line 629.
(gdb) b WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c:633
Breakpoint 3 at 0x8020fb4: file WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c, line 633.
(gdb) b WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c:638
Breakpoint 4 at 0x8020fb8: file WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c, line 638.
(gdb) c
Continuing.

Breakpoint 2, CAN_Transmit (CANx=, TxMessage=TxMessage@entry=0x2000bdec)
at WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c:629
629 in WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c
(gdb) c
Continuing.

Breakpoint 3, CAN_Transmit (CANx=, TxMessage=TxMessage@entry=0x2000bdec)
at WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c:635
635 in WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c
(gdb) p CANx->sTxMailBox[transmit_mailbox].TDLR
value has been optimized out
(gdb) p CANx->sTxMailBox[transmit_mailbox].TDHR
value has been optimized out
(gdb) l
630 in WICED/platform/MCU/STM32F2xx/peripherals/libraries/src/stm32f2xx_can.c
(gdb) p CANx->sTxMailBox[transmit_mailbox].TIR
value has been optimized out
(gdb) p TxMessage->DLC
$21 = 8 ‘\b’
(gdb) p CANx->sTxMailBox[transmit_mailbox].TDTR
value has been optimized out
(gdb)

I have seen several compiler optimizer issues with gcc. What is the optimizer level set to? I would recommend -O1 or -O0

It was using -Os and I tried -O0 but it wouldn’t build.

Building file: lib/mbedtls/library/bignum.c
Invoking: ARM GCC C Compiler
mkdir -p 
/build/target/communication/platform-6-m-prod-6/./lib/mbedtls/library/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFORM_NAME=photon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -g3 -gdwarf-2 -O0 -mcpu=cortex-m3 -mthumb -DPRODUCT_ID=6 -DPRODUCT_FIRMWARE_VERSION=65535 -DMBEDTLS_CONFIG_FILE="<mbedtls_config.h>" -DSYSTEM_VERSION_STRING=0.4.7 -DRELEASE_BUILD -Werror -I./lib/mbedtls/include -I./lib/tropicssl/include -I./src -I
/hal/inc -I
/hal/shared -I
/hal/src/photon -I
/hal/src/stm32f2xx -I
/hal/src/stm32 -I
/hal/src/photon/api -I
/dynalib/inc -I
/services/inc -Ilib/tropicssl/include -I. -MD -MP -MF 
/build/target/communication/platform-6-m-prod-6/./lib/mbedtls/library/bignum.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x80A0000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=8 -DMODULE_FUNCTION=4 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=0,0,0 -Wno-pointer-sign -std=gnu99 -c -o 
/build/target/communication/platform-6-m-prod-6/./lib/mbedtls/library/bignum.o lib/mbedtls/library/bignum.c
lib/mbedtls/library/bignum.c: In function ‘mpi_mul_hlp’:
lib/mbedtls/library/bignum.c:1134:1: error: r7 cannot be used in asm here
}
^
make[2]: *** [
/build/target/communication/platform-6-m-prod-6/./lib/mbedtls/library/bignum.o] Error 1
make[2]: Leaving directory /home/randal/Downloads/particle/20151220A/firmware/communication' make[1]: *** [communication] Error 2 make[1]: Leaving directory/home/randal/Downloads/particle/20151220A/firmware/modules/photon/system-part1’
make: *** [/home/randal/Downloads/particle/20151220A/firmware/modules/photon/system-part1/makefile] Error 2


It will build with -O1 but it is not recompiling the stm32f2xx_can.c though so that is not helping. Can you tell me what needs to be done?


randal@UBUNTU64:~/Downloads/particle/20151220A/firmware/modules$ find 
 -name *can.c*

/wiring/src/spark_wiring_can.cpp

/bootloader/src/photon/stdperiphdriver/stm32f2xx_can.c

/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/src/stm32f2xx_can.c

/platform/MCU/STM32F1xx/STM32_StdPeriph_Driver/src/stm32f10x_can.c

/hal-dynalib/src/hal_can.c

randal@UBUNTU64:~/Downloads/particle/20151220A/firmware/modules$ grep can REBUILD.log | grep -i Building
Building file: src/hal_can.c
Building file: src/stm32f2xx/can_hal.c
Building file: src/spark_wiring_can.cpp
Building file: src/stm32f2xx/can_hal.c
Building file: applications/can/application.cpp
Building target: 
/build/target/user/platform-6-m/applications/can/libuser.a
Building file: src/hal_can.c
Building file: src/spark_wiring_can.cpp
Building target: 
/
/
/build/target/user-part/platform-6-m/can.elf

randal@UBUNTU64:~/Downloads/particle/20151220A/firmware/modules$ find 
 -name *can.o*

/build/target/wiring/platform-6/src/spark_wiring_can.o.d

/build/target/wiring/platform-6/src/spark_wiring_can.o

/build/target/wiring/platform-6-m/src/spark_wiring_can.o.d

/build/target/wiring/platform-6-m/src/spark_wiring_can.o

/build/target/hal-dynalib/platform-6-m/src/hal_can.o.d

/build/target/hal-dynalib/platform-6-m/src/hal_can.o

You can probably force it to rebuild that file by editing it, doing a make clear, or deleting the .o file.

Perhaps you can just force that file to compile with -O1 by using a pragma in the c file.

Try using this format around the function that is having issues.

#pragma GCC push_options
#pragma GCC optimize ("O0")

your code

#pragma GCC pop_options
1 Like

I can do successful “make clean” without the “firmware/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/src/stm32f2xx_can.c” in the source tree.


2057 mv /home/randal/Downloads/particle/20151220A/firmware/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/src/stm32f2xx_can.c /home/randal/Downloads/particle/20151220A
2058 sudo make clean all program-dfu APP=can PARTICLE_DEVELOP=1 PLATFORM=photon USE_SWD_JTAG=y MODULAR=n
2059 history
randal@UBUNTU64:~/Downloads/particle/20151220A/firmware/main$ ls -l /home/randal/Downloads/particle/20151220A/firmware/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/src/can
ls: cannot access /home/randal/Downloads/particle/20151220A/firmware/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/src/can: No such file or directory


How do you remake the libraries?

make: *** No rule to make target ../hal/src/photon/lib/Lib_SPI_Flash_Library_BCM9WCDUSI09.a', needed by
/build/target/main/platform-6/can.elf’. Stop.

randal@UBUNTU64:~/Downloads/particle/20151220B/firmware/main$ history


2109 sudo find 
 -name *.elf -exec rm {} ;
2110 sudo find 
 -name *.a -exec rm {} ;
2111 sudo find 
 -name *.o -exec rm {} ;
2112 sudo make all program-dfu APP=can PARTICLE_DEVELOP=1 PLATFORM=photon USE_SWD_JTAG=y MODULAR=n
2113 history


If I remember correctly the stm32f2xx peripheral library is actually located in two places.

randal@UBUNTU64:~/Downloads/particle/20151224$ git clone https://github.com/spark/firmware
Cloning into ‘firmware’

remote: Counting objects: 41115, done.
remote: Total 41115 (delta 0), reused 0 (delta 0), pack-reused 41114
Receiving objects: 100% (41115/41115), 94.52 MiB | 10.03 MiB/s, done.
Resolving deltas: 100% (28790/28790), done.
Checking connectivity
 done.

randal@UBUNTU64:~/Downloads/particle/20151224$ find . -name \stm32f\_can\*
./firmware/bootloader/src/photon/stdperiphdriver/stm32f2xx_can.c
./firmware/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/src/stm32f2xx_can.c
./firmware/platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc/stm32f2xx_can.h
./firmware/platform/MCU/STM32F1xx/STM32_StdPeriph_Driver/src/stm32f10x_can.c
./firmware/platform/MCU/STM32F1xx/STM32_StdPeriph_Driver/inc/stm32f10x_can.h
./firmware/hal/src/photon/wiced/platform/MCU/STM32F2xx/peripherals/libraries/inc/stm32f2xx_can.h


What I want to do is rebuild hal/src/photon/lib/STM32F2xx_Peripheral_Libraries.a with -O0 but it doesn’t get created with a make clean in main.

I agree the hal/src/photon/lib/STM32F2xx_Peripheral_Libraries.a is NOT being rebuilt. Looks like we need some help.

@BDub how do you rebuild the STM32F2xx_Peripheral_Libraries.a?