How to compile in Web IDE, spark thermostat

I’m getting a compile error message that reads:
"‘sFLASH_WritePage’ was not declared in this scope"
application.cpp 56:57

Here’s the code, DESIRED_TEMP_FLASH_ADDRESS is defined as:
#define DESIRED_TEMP_FLASH_ADDRESS 0x80000
{
sFLASH_EraseSector(DESIRED_TEMP_FLASH_ADDRESS);
Serial.println(“Saving temperature to flash”);
uint8_t values[2] = { (uint8_t)desiredTemperature, 0 };
sFLASH_WritePage(values, DESIRED_TEMP_FLASH_ADDRESS, 2);
}

I think the problem is how “values” is defined and passed into sFLASH_WritePage(), but I’m not even sure where that function is declared.

Honestly I don’t even know where to find information on this function: sFLASH_WritePage(). I think it should be in an Adafruit library. Do I need to add a library?

Thanks in advance for any help. I really appreciate it.

-Shittyprogrammer

Some quick background… I’m trying to make a variant of the thermostat here:

using the firmware from their github page here:

I installed the new IDE on windows 8.1 from the download page here:

The files in the firmware folder are:
build.mk
application.cpp
glcdfont.c
Adafruit_LEDBackpack.h
Adafruit_LEDBackpack.cpp
Adafruit_GFX.h
Adafruit_GFX.cpp

These have all been copied to C:\Program Files (x86)\Spark Dev\core-firmware\src which I believe should work. I changed this in the make file:
TARGET_SRC_PATH = src
to
TARGET_SRC_PATH = C:\Program Files (x86)\Spark Dev\core-firmware\src

I’ll try to compile and see what’s wrong before reporting back :wink:

If you change the line from sFLASH_WritePage to sFLASH_WriteBytes it will compile fine.

The commit reflecting this change is here:

I have sent in a PR as well: https://github.com/spark/thermostat/pull/5

Hi Kenneth. Thanks for the reply. So, I don’t think my IDE is setup correctly. I’m getting the same error when I replace it.

What IDE did you use? Web-IDE? Windows? Linux?

I’m pretty sure my windows IDE isn’t setup correctly. All I did was run the executable. The web IDE is a pain. I’m not sure how to compile a make file with multiple files on the web-IDE. I’m struggling with the Linux dependencies. If I focus on one that I know works for someone else, then I’m sure I’ll have more luck.

You don’t need the make file. Using Spark-dev or Web IDE should work fine!

I get the same error when I compile it with the WebIDE, Spark-dev, make from the command line and NetBeans IDE. It’s also doesn’t matter if I use sFLASH_WriteBytes or sFLASH_WritePage. I still get this error:

'sFLASH_WriteBytes' was not declared in this scope

Can anyone help me with this? Is there a work around? What do these functions do?

sFLASH_WriteBuffer()
sFLASH_ReadBuffer
sFLASH_Init
sFLASH_EraseSector()
sFLASH_EraseBulk()

Where can I find this information instead of asking here?

Also, can ANYONE do me a big favor and, if they can compile this, send me the .bin file? I want to check my hardware to see if it’s working. It would be nice while I’m working on the software side.

Thanks in advance for any help.

1.) Those functions are low-level used to handle the interaction with the external SPI flash.

Probably used as the EEprom library was not available at that time the project was hacked together.

2.) Why don’t’ you use Spark-CLI? I used that to compile and did not take me more than 5 minutes to get it running…

So, just to close this one out. This function worked perfect.

Thanks for the help Kenneth. I appreciate it.

1 Like

Tried to compile, got same result, looks like it is because original function was declared as void sFLASH_WritePage and now is static void sFLASH_WriteBytes, the application can’t call static void sFLASH_WriteBytes if it doesn’t declare as void function in sst25vf_spi.h

I also found the issue that current repository of SPARK Core Firmware doesn’t have spark_wiring_network.cpp in src folder, also build.mk in src is different from the file in spark thermostat project.

I believe those two issues need to be solved to compatible with latest Spark Core Firmware