Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Squonk
#1288 Linker scripts can rapidly become an awful mess too... Just struggling with one on ARM Cortex M :)

Generally, you avoid touching them if possible and don't put peripheral register definitions in them, to keep them standard.

OTOH, defining these registers inside include files is rather common, one reason being that they do not depend on the linker you use, and second that you can add attributes for specific memory access (like disable caching, etc.). So even if some definitions look over-complicated, they may (or not) have their purpose, and writing your PIN_* as a define on top of the existing ones with longer names is a better option IMHO.

As for the PIN_2 register, it may contain some pin-specific stuff, like pull-up/pull-down enable/disable, drive strength, open-drain configuration, etc?
User avatar
By Squonk
#1294
mamalala wrote:As for the other two registers, yes and no. Yes because they directly corrospond to a given pin. No because just writing 0/1 to it does not really change the output state of the pin, at least not the way one would expect. For example, PIN_2 is obviously masked internally. You can "only" set bits in a bitmaks of 0000.0000.0000.0001.1111.1000.0101. Now, for just setting an output state, those are too many bits. I'm sure there is more to them than just setting the output.

In fact, the purpose of each of these bits can be found in... the eagle_soc.h defines :mrgreen:
https://github.com/scottjgibson/esp8266 ... soc.h#L105

  • Bit 0 is source
  • Bit 2 is driver
  • Bit 7-9 is INT type
  • Bit 10 is wakeup enable
  • Bit 11-12 is pin config
User avatar
By mamalala
#1304
Squonk wrote:Linker scripts can rapidly become an awful mess too... Just struggling with one on ARM Cortex M :)


Well, they pretty much are a mess already. But you are right, i should put that in as a #define instead. However, i will not prop it on top of their mess ;)

Greetings,

Chris
User avatar
By mamalala
#1305
Squonk wrote:In fact, the purpose of each of these bits can be found in... the eagle_soc.h defines :mrgreen:
https://github.com/scottjgibson/esp8266 ... soc.h#L105

  • Bit 0 is source
  • Bit 2 is driver
  • Bit 7-9 is INT type
  • Bit 10 is wakeup enable
  • Bit 11-12 is pin config


'Doh. Now i feel stupid :P

Greetings,

Chris