But the footing itself may keep you at a distance from the wall. Usually, a footing is twice the wall thickness, so an 8" block or brick-n-block foundation should have a 16"-wide footing. That would mean at least 4" of footing outside the foundation wall.
For a driven electrode, its to be in permanent moisture if practicable. So if you can get it out away from the foundation, that will lower the resistance somewhat.