stm32-rs / stm32l4xx-hal

A Hardware abstraction layer for the stm32l432xx series chips written in rust.
157 stars 104 forks source link

ADC/linker problem - won't compile (STM32L432KC) #227

Open nebelgrau77 opened 3 years ago

nebelgrau77 commented 3 years ago

I'm trying to use the ADC example with an STM32L432KC. If I specify version 0.6.0 of the crate, it can't find ADC1, ADC_COMMON or rcc.ccipr. I used git = "git = "https://github.com/stm32-rs/stm32l4xx-hal" instead and it seemed to compile OK, but then it won't:

note: "rust-lld" "-flavor" "gnu" "--eh-frame-hdr" "-L" (omitted) = note: rust-lld: error: undefined symbol: ADC1_2

referenced by stm32l4.arnfbrxu-cgu.3 stm32l4-3c82b24cdd335e86.stm32l4.arnfbrxu-cgu.3.rcgu.o:(__INTERRUPTS) in archive

I believe I have everything necessary installed, I actually have some firmware already working on the same board, I just wanted to add ADC. Is it something I'm doing wrong, or an actual issue with the crate?

Thanks!

korken89 commented 3 years ago

Seems like an error in the PAC with the fields and interrupt definition. Could you have a look between the PAC and the reference manual?

nebelgrau77 commented 3 years ago

I don't think I'm versed enough in those details, but I see that in PAC there are the following lines:

ADC1:  
    _modify:    
        _interrupts:      
            ADC1:        
                name: ADC1_2

and ADC1_2 also appears in the NVIC vector table in the RM as ADC1 and ADC2 global interrupt (page 322). I don't know if it's any help to understand the problem, though.

korken89 commented 3 years ago

Hmm, unclear what is the issue here. But the error you get are consistent with an error in the PAC.

Could you open an issue in stm32-rs/stm32-rs and link it here?

nebelgrau77 commented 3 years ago

OK, done: https://github.com/stm32-rs/stm32-rs/issues/561

korken89 commented 3 years ago

Thanks!