These are chat archives for esp8266/Arduino

14th
Jun 2015
Me No Dev
@me-no-dev
Jun 14 2015 03:18
@Makuna I got my bed adhersion right on spot :) did the dance for a while,then i found my mom's nail polish cleaner that I apply straight onto the capton tape for ABS, then blue tape for PLA and result is 100% success if the model is sliced properly. But the last becoming an issue lately... at the fourth layer the percentage went up to 90% then stop in the middle of the layer... suckage, wasted plastic and overall fail :D
alon24
@alon24
Jun 14 2015 13:53
Hi, me again, what do i need to change in order to use my 4M esp12e with latest arduinoide and 112? can I do that (I am now sure my chip is 4M)
@ficeto were u able to use 4M chip?
alon24
@alon24
Jun 14 2015 14:02
@Links2004 do you guys support c8 4016? 4M chip? do I need to do anything special for it?
Ivan Grokhotkov
@igrr
Jun 14 2015 14:35
@alon24 depending on whether your esp12e has dual or quad flash interface, you should try selecting either nodemcu 1.0 or generic (4M) as your board.
because nodemcu 1.0 is basically esp12e with DIO flash
alon24
@alon24
Jun 14 2015 14:54
How do i know if it is using 112? where does arduino ide take the sdk from?
Ivan Grokhotkov
@igrr
Jun 14 2015 14:55
what is 112?
oh, you mean SDK 1.1.2?
alon24
@alon24
Jun 14 2015 14:56
yes
if i change in C:\arduino-1.6.4\ESP8266\Espressif\ESP8266 and put the 112 sdk in it, will it take it from there?
when i burn I see:
Sketch uses 197,420 bytes (37%) of program storage space. Maximum is 524,288 bytes.
Uploading 31488 bytes from C:\Users\ilan\AppData\Local\Temp\build6545776952552255402.tmp/Blink.cpp_00000.bin to flash at 0x00000000
...............................
Uploading 165976 bytes from C:\Users\ilan\AppData\Local\Temp\build6545776952552255402.tmp/Blink.cpp_10000.bin to flash at 0x00010000
...................................................................................................................................................................

even though i selected the flash size 4m
is this ok?
Ivan Grokhotkov
@igrr
Jun 14 2015 15:11
it's not using 1.1.2, the stable branch uses 1.0 and the staging branch is on 1.1.1
alon24
@alon24
Jun 14 2015 15:31
how can I use the staging branch?
@igrr what does selecting a different flash size actually do, behind the scenes, just change the flash command?
or does it change the resulting file that is being burned, to 4m size?
Me No Dev
@me-no-dev
Jun 14 2015 15:40
setting it to 4M makes the space larger, the eeprom and init data are moved to the proper place
so on... not ust a command
alon24
@alon24
Jun 14 2015 15:42
but still it reports 512 space on the console
Me No Dev
@me-no-dev
Jun 14 2015 15:42
does not matter ;)
that is different calculation
alon24
@alon24
Jun 14 2015 15:43
so u say I have more space? for code? that I am Taking advantage of it?
Me No Dev
@me-no-dev
Jun 14 2015 15:44
yes
and more you'll be taking advantage of largerFS space as well
alon24
@alon24
Jun 14 2015 15:47
nice
Ivan Grokhotkov
@igrr
Jun 14 2015 16:19
if it says 512k on the console then something's wrong. 4m flash should have 1m code size...
alon24
@alon24
Jun 14 2015 16:28
Can any one with 4m confirm that, or is it from experience?
Me No Dev
@me-no-dev
Jun 14 2015 16:28
confirm what?
alon24
@alon24
Jun 14 2015 16:29
that 4m should display 1m for code and not 512
likr igrr said
Me No Dev
@me-no-dev
Jun 14 2015 16:30
check your tools/sdk/ld/eagle.flash.4m.ld
should look like:
/* Flash Split for 4M chips */
/* sketch 1019KB */
/* spiffs 3052KB */
/* eeprom 20KB */

MEMORY
{
  dport0_0_seg :                        org = 0x3FF00000, len = 0x10
  dram0_0_seg :                         org = 0x3FFE8000, len = 0x14000
  iram1_0_seg :                         org = 0x40100000, len = 0x8000
  irom0_0_seg :                         org = 0x40201010, len = 0xfeff0
}

PROVIDE ( _SPIFFS_start = 0x40300000 );
PROVIDE ( _SPIFFS_end = 0x405FB000 );
PROVIDE ( _SPIFFS_page = 0x100 );
PROVIDE ( _SPIFFS_block = 0x2000 );

INCLUDE "../ld/eagle.app.v6.common.ld"
alon24
@alon24
Jun 14 2015 16:31
what patth (full)?
c:\tools?
Me No Dev
@me-no-dev
Jun 14 2015 16:32
no
alon24
@alon24
Jun 14 2015 16:32
C:\arduino-1.6.4\ESP8266\Espressif\ESP8266\ESP8266_SDK\ld
Me No Dev
@me-no-dev
Jun 14 2015 16:33
where your Arduino esp8266 files ate
[rduino path]/hardware/esp8266com/esp8266/tools...
alon24
@alon24
Jun 14 2015 16:34
I do not have that path
Me No Dev
@me-no-dev
Jun 14 2015 16:35
then you are not using this IDE and SDK
alon24
@alon24
Jun 14 2015 16:35
arduino 164, and used board manager to download the esp8266 files
Me No Dev
@me-no-dev
Jun 14 2015 16:36
do not know where those go
alon24
@alon24
Jun 14 2015 16:36
how do u get esp into arduino? what process do u use?
Me No Dev
@me-no-dev
Jun 14 2015 16:36
clone the repository
cd build
ant dist
resulting new app is in build/windows/work/
alon24
@alon24
Jun 14 2015 16:39
the repository will bring full arduino?
Me No Dev
@me-no-dev
Jun 14 2015 16:39
it should be fine with the package manager but do not know where it puts the files from the packages
alon24
@alon24
Jun 14 2015 16:39
or just the esp stuff? for hardware?
Me No Dev
@me-no-dev
Jun 14 2015 16:39
it's a full arduino IDE
with support for ESP8266 and the usual arduino stuff
same IDE basicali, but has the esp things build in
alon24
@alon24
Jun 14 2015 16:42
found mine: in C:\Users\ilan\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-673-g8cd3697\tools\sdk\ld
/* Flash Split for 4M chips */
/* irom0  960KB */
/* spiffs 3052KB */
/* eeprom 20KB */

MEMORY
{
  dport0_0_seg :                        org = 0x3FF00000, len = 0x10
  dram0_0_seg :                         org = 0x3FFE8000, len = 0x14000
  iram1_0_seg :                         org = 0x40100000, len = 0x8000
  irom0_0_seg :                         org = 0x40210000, len = 0xF0000
}

PROVIDE ( _SPIFFS_start = 0x40300000 );
PROVIDE ( _SPIFFS_end = 0x405FB000 );
PROVIDE ( _SPIFFS_page = 0x100 );
PROVIDE ( _SPIFFS_block = 0x2000 );

INCLUDE "../ld/eagle.app.v6.common.ld"
its differenet than yours
should i change it to be like urs?
Me No Dev
@me-no-dev
Jun 14 2015 16:47
no, this one is fine
you just have an older version of things that does not have the space calculator correct
Michael Miller
@Makuna
Jun 14 2015 18:33
@igrr Can ICACHE_RAM_ATTR be applied to C++ member functions? How does it show up in a dump to know that it gets applied?
Ivan Grokhotkov
@igrr
Jun 14 2015 18:36
yes that should work. if you run objdump -t and grep for the function name, you should see its address above 0x42000000
pretty cool, we can now use i2s output
Me No Dev
@me-no-dev
Jun 14 2015 18:38
finally!
Ivan Grokhotkov
@igrr
Jun 14 2015 18:39
but the readme says that to stream reliably you need an external SPI RAM
well, that's still something
Me No Dev
@me-no-dev
Jun 14 2015 18:40
where would that ram be hooked into?
i2s pins are the spi pins + SerialRX and Serial1TX
Ivan Grokhotkov
@igrr
Jun 14 2015 18:41
on the SPI0, overlapped with the flash
I suppose we can hack an example which will play mp3s from an SD card
Me No Dev
@me-no-dev
Jun 14 2015 18:45
will see if I can give it a go tonight
Ivan Grokhotkov
@igrr
Jun 14 2015 18:45
but then the SD card will have to be hooked up to SPI0 in overlapped mode
Me No Dev
@me-no-dev
Jun 14 2015 18:45
why?
they use pins 2,3 and 15
Ivan Grokhotkov
@igrr
Jun 14 2015 18:46
don't you need 15 for SD?
Me No Dev
@me-no-dev
Jun 14 2015 18:46
only need to use something for SS for the SD
any other pin will do
Ivan Grokhotkov
@igrr
Jun 14 2015 18:46
OK, right
Michael Miller
@Makuna
Jun 14 2015 19:53
@igrr I thought class member were marked as flash by default, all the class members of my library are above 0x42000000 range.
Me No Dev
@me-no-dev
Jun 14 2015 19:55
are they above 0x40201000 ? that is in the fash
in irom0
Ivan Grokhotkov
@igrr
Jun 14 2015 19:57
they are above 0x42001000, that's also true :)
contents of all .cpp files go into flash by default
@Makuna I actually meant that it should be below 0x4200000 if you apply RAM attribute. sorry :)
Michael Miller
@Makuna
Jun 14 2015 20:01
millis() is broken by the way, the value it returns is "higher" than millis, so it can't be used to time things.
higher value, so timing happens faster
Ivan Grokhotkov
@igrr
Jun 14 2015 20:04
oh, and how did you measure that?
Michael Miller
@Makuna
Jun 14 2015 20:04

@igrr so I mark the member in the cpp like...

void ICACHE_RAM_ATTR NeoPixelBus::Show(void)

and it doesn't get moved to ram.

Do I need to mark it in the header the same way?
Ivan Grokhotkov
@igrr
Jun 14 2015 20:06
normally you would place an attribute on the declaration as well. but I need to check gcc docs, I don't remember specifics
Michael Miller
@Makuna
Jun 14 2015 20:06
@igrr This simple sample, the output spew is as fast as it can go

void setup()
{
  delay(10000); // time to reattach serial debug tool

  Serial.begin(115200);
  Serial.println("Alive and well...");
  Serial.flush();
}


void loop()
{
    uint32_t last;

    Serial.println("waiting 10 seconds");

    last = millis();
    while ((last - millis()) < 10000)
    {
        delay(0);
    }

    Serial.println("waiting 3 seconds");
    last = millis();
    while ((last - millis()) < 3000)
    {
        delay(0);
    }
}
Ivan Grokhotkov
@igrr
Jun 14 2015 20:07
last - millis() is negative
and last is unsigned
perhaps millis() - last is what you meant?
so last - millis() will be around UINT_MAX, which is not less than 10000 so comparison will be false
Michael Miller
@Makuna
Jun 14 2015 20:13
The ram attribute is not working, my method is still showing up at 40202658, I marked the declaration the same. Could it be the location the attribute is placed at? Should it be before the return type?
@igrr on the topic of millis(), yup, not enough sleep.
@igrr as in, I had the order of the math wrong and I need more sleep ;-)
Michael Miller
@Makuna
Jun 14 2015 20:34
@igrr I also pulled the code out of the member function into a static function marked as ram, and had the member call it. The compiler inlined the code and removed the call to method and thus ignored the ram attribute. Is there a way to mark code so it won't get optimized?
Michael Miller
@Makuna
Jun 14 2015 20:46
Ahh, GCC requires pragmas to marked as gcc to actual work, this seems to quit inlining the static function
#pragma GCC push_options
#pragma GCC optimize ("O0")
// disabled optimization code
#pragma GCC pop_options
but the function address is still not in RAM
402025f8 <_ZL15send_pixels_800PhS_h>:
Ivan Grokhotkov
@igrr
Jun 14 2015 20:47
perhaps the linker script rules override the attributes
one thing which should certainly work is to place the function into .c file
Michael Miller
@Makuna
Jun 14 2015 20:48
I will try that
Ivan Grokhotkov
@igrr
Jun 14 2015 20:49
but this kind of defeats the purpose as you would still need a function in flash to call it...
Michael Miller
@Makuna
Jun 14 2015 21:04
By placing it in a C does indeed move it into RAM, and yes it is being called from a flash member function. BUT, the interesting part is that this does seem to solve my bit bang timing issue on the first pulse.
Can we look into a way to have member methods be in RAM rather than flash, to not have the linker flag override the code flags?
Ivan Grokhotkov
@igrr
Jun 14 2015 21:26
one way that comes to mind is to place the function into a separate section (e.g. .iram.text), and change the rules a bit so that .text section from .cpp files will go into .irom0.text whereas .iram.text section from the said files will go into .text
but then you will be only able to use this attribute in .cpp files
chad cormier roussel
@chadouming
Jun 14 2015 21:27
attribute ((noinline)) ?
Ivan Grokhotkov
@igrr
Jun 14 2015 21:27
which can be worked around with some #ifdef __cplusplus...
attribute section .iram.text
Me No Dev
@me-no-dev
Jun 14 2015 22:31
I2S will require some rework on the Serial library
since we can use only TX0 or swap, but swap will kill the SPI
seems quite easy to turn into SD card payer