Context-switching Branch vs. master [Solved]

@bko @zach @zachary @satishgn

I was building an application locally using netbeans on ubuntu with core branch of context-switching (for some reason I switched from master). The problem is as the code size of my application increased, I run into “region ‘FLASH’ overflow by 108234 bytes” error.

In the post https://community.spark.io/t/union-supported-by-compiler/2714, people mentioned that the problem is fixed on the latest release of the master branch. I switched back to that branch and the code compiled without overflow error.
But after I load the code to the spark board, the program didnt work as expected . For test, I compiled a simple LED blink code. It is not able to work using the master branch while it works with the context-switching branch.

I couldnot figure out what the problem is. Any idea?

regards,
Muez

Hi @Muez

The Spark Team will have the best answer but I know they have been travelling at bit.

I think the context-switching branch was for work done a while ago that is now incorporated, so that is not a good choice to use since all that work is in the master and compile-server2 (webIDE) branches already.

I also think that the problem mentioned in the “Union supported by compiler” thread has been in master and compile-server2 branches for some time as well.

The master branch represent the latest and greatest Spark code, but it has not been thoroughly tested yet. Consider it the latest but experimental build area. When it is tested, it moves through a few steps to eventually become the compile-server2 branch used by the webIDE.

Maybe you should say what the problem you are seeing is when building from the master branch? Can you post the simple LED blink or is it just the demo Spark provides? Is the LED sequence normal?

Hi @bko

The code is just a simple LED blink ON OFF in 1 second interval.

#define ON 1
#define OFF 0

int led = D7;

void setup() {

// Initialize D0 pin as output
pinMode(led, OUTPUT);

}

void loop() {

digitalWrite(led, HIGH); 
delay(1000);
digitalWrite(led, LOW); 
delay(1000);

}

The context-switching branch has been working perfectly until I run into the “region ‘FLASH’ overflow by 108234 bytes” error. Then after switching to Master branch, I learned that even the simple LED blink is not working (the core blinks green and other LED doesnt blink at all).

regards

OK, blinking green means that wifi is not connecting. A would recommend a factory reset and putting in the wifi credentials again. Something must have clobbered them.
.
I checked github and the latest commits on the context-switching branch are from two months ago, so I cannot recommend that you use that branch.

1 Like

Good question @Muez, and @bko’s answers are right on the money. Your blink sketch should work fine after a factory reset.

The context-switching branch was an attempt to add RTOS features to the Core, however it took so much additional memory that we all agreed the tradeoff was not worthwhile.

One particular problem we were trying to solve with the context-switching branch was that user applications with long delays would disconnect from the :spark: Cloud. Now, we perform the necessary Cloud communication during calls to delay() which was a more elegant way to solve the problem.

Cheers!

Hi @zachary @bko

Thank you for your help,

It turns out that the board needed to get CC3000 Patch applied to it.
After applying the patch, I was able to run the simple LED code and my application that was causing overflow region Flash error.

Here is the patch, just in case:

cheers

3 Likes