Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rp2040 UF2 file works well. But .elf or .hex is not working #7

Open
MVinothPMS opened this issue Jul 29, 2023 · 7 comments
Open

rp2040 UF2 file works well. But .elf or .hex is not working #7

MVinothPMS opened this issue Jul 29, 2023 · 7 comments

Comments

@MVinothPMS
Copy link

Demo.UF2 is executing without any issues.
But when I use Demo.elf, the program is not executing.
I am able to load blink.elf(blink program from PICO SDK 1.5.0) successfully using picoprobe to target rp2040

@ataradov
Copy link
Owner

This project includes a boot sector that needs to have a valid CRC included. You have two options:

  1. Program a BIN file passed though this utility https://github.com/ataradov/tools/tree/master/bin2uf2
  2. Do this once and see what CRC is generated for your compiler setup and edit rp2040.ld and change the value in "LONG(0xcccccccc)" to a real CRC value. After that all ELF file will include a valid CRC. At least until you change the compiler version and it generates a different code.

@MVinothPMS
Copy link
Author

MVinothPMS commented Aug 2, 2023 via email

@ataradov
Copy link
Owner

ataradov commented Aug 2, 2023

With "-u" option it would generate raw binary file, not UF2 file, so I'm not sure how it works for you.

Can you attach your binary file so I can check it on my side?

@lakis70
Copy link

lakis70 commented Aug 25, 2023

i have weact rp2040 with 16mb flash. The blink Demo.uf2 works.
note: i add the flag -mfloat-abi=softfp because it made error
sorry, unimplemented: Thumb-1 hard-float VFP ABI
compiling with arm-none-eabi-gcc 10.2 and newlib 3.0.
Thank you very much for your work

@lakis70
Copy link

lakis70 commented Oct 1, 2023

How do you initialize the ADC module? They say disable digital functions and make pin input. Is my code right?

`HAL_GPIO_PIN(ch0, 0, 26, null) ; //pin name, port, Gpio26, function ADC)
//pin33 analog ground

void init_ADC(void) {
RESETS_CLR->RESET = RESETS_RESET_adc_Msk ; //reset

ADC->CS = ADC_CS_EN_Msk ; 
ADC->CS = ADC_CS_AINSEL_Msk ; //select Ch0 gpio26

HAL_GPIO_ch0_in() ; //set direction in
HAL_GPIO_ch0_pulldown(); //disable pull-up

}
`
Thank you.

@ataradov
Copy link
Owner

ataradov commented Oct 1, 2023

I think digital functions are disabled by default on the ADC pins anyway, so just don't do anything.

Also, _pulldown() enables pull-down. There is currently no function to disable both, so don't enable any of them

For the ADC itself - I have no idea, never used it. But your two writes to CS are clearly not correct. The second write will overwrite the EN write.

@lakis70
Copy link

lakis70 commented Oct 1, 2023

i will try later and report. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants