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

Unit Testing with unity using ceedling on Tarhet Hardware. Programming Target Failed #683

Open
shabu19 opened this issue Jul 12, 2023 · 0 comments

Comments

@shabu19
Copy link

shabu19 commented Jul 12, 2023

Hi,
The Scenario
I am working on unit testing with unity using Ceedling. So far, I have been able to run my tests on Simulator. Now I want to run my tests on target hardware. I am trying to incorporate unit test in an already existing released project. I added some modules and test files to my project.

The Development
When I try to run these tests on simulator using Ceedling, they run fine (and generates test_build.elf or hex file in the test->out folder). The mdb commands from sim are as follow

device PIC18F25K22
hwtool sim
set oscillator.frequency            32
set oscillator.frequencyunit        Mega
set oscillator.rcfrequency          31
set oscillator.rcfrequencyunit      Kilo
set uart1io.uartioenabled           true
set uart1io.output                  stdout
set uart1io.outputfile              test/simulation/out.txt
set breakoptions.wdtwarnings        Ignore

program C:\Users\shahbaz.khan\MPLABXProjects\unit_testing\rm3_wifi_ceedling_ut\build\ceedling\generated\test\out\test_build.elf

Run
Sleep 5000
Quit

I build the project from MPLABX (while excluding all the unity/test files) and then I tried to debug the project using command line and it works well. I launched MPLABX debugger (simply running command: mdb.bat) from cmd and run following commands.

device PIC18F25K22
Hwtool icd4
set AutoSelectMemRanges manual
set memories.programmemory true
set memories.programmemory.start 0x0000
set memories.programmemory.end 0x3FFF
set programoptions.eraseb4program true
set programoptions.pgcconfig pulldown
set programoptions.pgcresistor.value 4.7
set programoptions.pgdconfig pulldown
set programoptions.pgdresistor.value 4.7
set programoptions.pgmentry.voltage high
set programoptions.pgmspeed Med

program C:\Users\shahbaz.khan\MPLABXProjects\unit_testing\project_x\dist\default\production\rm3_wifi_ceedling_ut.production.hex

run
write pin RA2 high
sleep 5000
quit

The Problem
As I already have the test_build.hex file from the testing using ceedling, I am trying to use that build file to flash it in the target hardware using the exact same commands as above and only changing the file path (build file from ceedling) to program command as

program C:\Users\shahbaz.khan\MPLABXProjects\unit_testing\project_x\build\ceedling\generated\test\out\test_build.elf
I get the follwoing errors

Programming target...
The requested operation cannot continue with the following configuration bit setting(s):

Watchdog Timer Enable bits = On

Would you like MPLAB to change the config setting(s) and continue?

NOTE: This will change configuration memory for this session only. It will not change the configuration bit settings in your code [yes/no]

>y

Erasing...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3fff
configuration memory
EEData memory
User Id Memory

Script GetVersionDE failed with status Type = runScript, Script name = GetVersionDE, Status = 0xa00
.
The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding. The most common causes for this failure are oscillator and/or PGC/PGD settings.
Program failed.
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

1 participant