u-boot-2012.04.01编译问题4:‘coloured_LED_init’ aliased to external symbol ‘__coloured_LED_init’

编译uboot时遇到问题:board.c:87:6: error: 'coloured_LED_init' aliased to external symbol '__coloured_LED_init'

找出源文件:find -name board.c

~/test/u-boot-2012.04.01$ find -name board.c
./board/nvidia/common/board.c
./board/xes/common/board.c
./arch/arm/cpu/armv7/omap3/board.c
./arch/arm/cpu/armv7/am33xx/board.c
./arch/arm/cpu/armv7/tegra2/board.c
./arch/arm/lib/board.c
./arch/sparc/lib/board.c
./arch/avr32/lib/board.c
./arch/microblaze/lib/board.c
./arch/sandbox/lib/board.c
./arch/mips/lib/board.c
./arch/nios2/lib/board.c
./arch/nds32/lib/board.c
./arch/sh/lib/board.c
./arch/powerpc/lib/board.c
./arch/blackfin/lib/board.c
./arch/m68k/lib/board.c
./arch/openrisc/lib/board.c
./arch/x86/lib/board.c

打开board.c文件:~/test/u-boot-2012.04.01$ vim ./arch/arm/lib/board.c +87

inline void __coloured_LED_init(void) {}
void coloured_LED_init(void)
        __attribute__((weak, alias("__coloured_LED_init")));
去掉__coloured_LED_init 函数的inline修饰,重新编译后问题解决。

参考:Uboot 编译问题-“xxx aliased to external symbol xxx”

 

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sure, here's how you can use the light sensor on the picoprobe development board to create a night light: (a) 1. Initialize the ADC to read from the light sensor. 2. Read the raw ADC value from the light sensor. 3. Print out the raw ADC value in the format "Light Sensor: Raw: [value]". 4. Convert the raw ADC value to a voltage using the formula: voltage = (raw_value * 3.3) / 4095, where 3.3 is the maximum voltage and 4095 is the maximum raw ADC value. 5. Print out the voltage value in the format "Voltage: [value] V". 6. Use the voltage value to control the three-colour LED. (b) Here's some sample code to perform the above steps: ```c #include <stdio.h> #include "pico/stdlib.h" #include "hardware/adc.h" #include "hardware/gpio.h" #define LED_RED 25 #define LED_GREEN 26 #define LED_BLUE 27 #define LIGHT_SENSOR 2 int main() { stdio_init_all(); adc_init(); adc_gpio_init(LIGHT_SENSOR); adc_select_input(LIGHT_SENSOR); gpio_init(LED_RED); gpio_set_dir(LED_RED, GPIO_OUT); gpio_init(LED_GREEN); gpio_set_dir(LED_GREEN, GPIO_OUT); gpio_init(LED_BLUE); gpio_set_dir(LED_BLUE, GPIO_OUT); while (1) { uint16_t raw_value = adc_read(); printf("Light Sensor: Raw: %d\n", raw_value); float voltage = (raw_value * 3.3) / 4095; printf("Voltage: %.1f V\n", voltage); if (voltage < 1.0) { // dim the LEDs when the room is dark gpio_put(LED_RED, 255); gpio_put(LED_GREEN, 255); gpio_put(LED_BLUE, 255); } else { // turn off the LEDs when there is enough ambient light gpio_put(LED_RED, 0); gpio_put(LED_GREEN, 0); gpio_put(LED_BLUE, 0); } sleep_ms(1000); } return 0; } ``` (c) In the above code, we are dimming all three LEDs to create white light when the room is dark and turning them off when there is enough ambient light. The threshold voltage for detecting darkness is set at 1.0 V in this example, but you can adjust it to suit your needs.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值