Hydrostatic nucleosynthesis. I - Core helium and carbon burning.