Page 1 of 1

'Relocation truncated to fit' error when moving adc_channel to bss section in ulp_adc_example

Posted: Sat Feb 03, 2018 5:07 pm
by maciej
Hi,
I would like to control adc channel used in ULP program same as thresholds in ulp_adc_example.

I moved

Code: Select all

	/* ADC1 channel 6, GPIO34 */
	.set adc_channel, 6
to

Code: Select all

	.bss
	.global adc_channel
adc_channel: 
	.long 0
and use adc_channel as adc param

Code: Select all

	adc r1, 0, adc_channel + 1
This change introduce compile error:

Code: Select all

(.text+0x18): relocation truncated to fit: R_ESP32ULP_ADC_MUX against symbol `adc_channel' defined in .bss section in adc.ulp.o
Please help :)

Re: 'Relocation truncated to fit' error when moving adc_channel to bss section in ulp_adc_example

Posted: Mon Feb 05, 2018 12:55 am
by ESP_igrr
The third argument to the ADC instruction has to be a literal value, not a pointer or a register.


adc r1, 0, adc_channel + 1 means that you are doing ADC conversion with the ADC channel number set to the address of 'adc_channel' variable, which is probably not what you want.

Re: 'Relocation truncated to fit' error when moving adc_channel to bss section in ulp_adc_example

Posted: Mon Feb 05, 2018 12:11 pm
by maciej
ESP_igrr wrote:The third argument to the ADC instruction has to be a literal value, not a pointer or a register.


adc r1, 0, adc_channel + 1 means that you are doing ADC conversion with the ADC channel number set to the address of 'adc_channel' variable, which is probably not what you want.
Thank you for your reply. So can I, in some way, control in main program ADC channel used in ULP program?