How to flash .h and .cpp files to a device?

@ninjatill, the errors I see are:

error
/Users/avtolstoy/Development/particle/photon-wiced/WICED/platform/MCU/STM32F2xx/peripherals/libraries/stm32f2xx_flash.c:317:0: undefined reference to "__flash_acquire"
error
/Users/avtolstoy/Development/particle/photon-wiced/WICED/platform/MCU/STM32F2xx/peripherals/libraries/stm32f2xx_flash.c:335:0: undefined reference to "__flash_release" 

The FLASH_Lock() function is a low level function defined in STM32F2xx_flash.c but the make plumbing seems to be off such that these errors pop up. @ScruffR, any thoughts?

1 Like

@stankcheeze, it seems that changes in the DeviceOS after 0.6.3 break the FLASH_Lock() call. Compiling with DeviceOS version 0.6.3 produces no errors so give that a shot.

2 Likes

Good find! how do i compile with 0.6.3? Or should i just comment those calls out?

In the Web IDE, click on the “Devices” menu and change the “System Firmware Target:” for your device to 0.6.3:

image

1 Like

For some more reading on the Web IDE, here are the references: https://docs.particle.io/tutorials/developer-tools/build/photon/#wait-what-is-firmware-

A while back I've seen a similar report and here is Rick's response back then

1 Like

I changed the firmware target to 0.6.3 and it verified. However, when i go to flash it, it is giving “You are not including led.h log_backup.h rest_client.h wifi_login.h even though they are a part of this app. Are you sure you want to continue? To include these files, please hit cancel and add include lines to the top of the
to the top of the main app file”. Should i proceed?

That's just an ignorant warning from the Web IDE which expects you to include these headers in your .ino file since it doesn't know that you'll be indirectly including it anyhow.
This doesn't harm the program at all, but if you want, you can add the include statements to remove that message.

ok. i will try again this evening. thanks again everyone for your help.

2 Likes

update… i had to login with a different laptop at home. i was getting several more error messages. i removed the MACS app and readded them back in with the instructions from above. I copied the contents of the main.cpp into the macs.ino, added the #pragma once into the .h files (first line), set the rom level to 0.6.3 now i am getting one error message. undefined reference to “wlan_select_antenna”. i tried to bring back the app link that i sent out in this message, however, all i get is a blank screen when i click on the link. i have been working on this for hours and trying not to bother you… https://go.particle.io/shared_apps/5c4ddd94405ba5554b0014c7

Once you remove the base project from your account all shared revisions get invalidated too.
This is the version I've still got stored

This builds for me with 0.6.3 (as does yours)

1 Like

Having trouble opening shared files… When i click on your link (or any other shared app links), it opens up the Particle Web IDE page and I do not get anything else? Do i add it thru the libraries? I have tried copying the link directly into Chrome, Firefox, Internet Explorer and… (father forgive me… Edge).

I’m using Chrome and just clicking on the link should suffice.
However, when you copy/past the link make sure you are not also copying the view count that’s automatically appended to the link.
My link ends on 118 but when copy/paste it I get 1182 (currently two views have been registered).

I was able to bring in your saved files. Thanks for the link. I am still getting "undefined reference to “wlan_select_antenna” when i verify. This is so strange. It was working… Grrr…

Are you sure you are targeting a Photon and have set the build target to 0.6.3?

Yes, it is showing the Photon connected. I am set to build 0.6.3.

can u see if it that link will compile for you? This is bizarre.

You have not selected the Photon as target - it needs to have the yellow star activated to actually become the desired target.

2 Likes

That was it!!! I thought if i was connected to it (i was flashing the lights) that is all i needed to to do. Good catch! i owe you lunch … thanks again!

1 Like

Then how would it know which device to flash :wink: ?