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

maciej
Posts: 3
Joined: Sat Feb 03, 2018 4:50 pm

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

Postby maciej » Sat Feb 03, 2018 5:07 pm

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 :)

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

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

Postby ESP_igrr » Mon Feb 05, 2018 12:55 am

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.

maciej
Posts: 3
Joined: Sat Feb 03, 2018 4:50 pm

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

Postby maciej » Mon Feb 05, 2018 12:11 pm

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?

Who is online

Users browsing this forum: Baidu [Spider] and 64 guests