Engineers early in the gunpowder age would build defences outside the walls, rather than inside. One of the most common approaches was to build wooden retaining walls in front of the stone walls and fill the spaces between with dirt. Given enough time and resources, this can be quite elaborate, with compartmentalized sections and even two layers of wood and earth if time and resources permit.
If the siege is already started and sending engineers outside isn't an option, bundles of wood could be lashed tightly together and lowered in front of the walls to absorb the impact of the cannon balls. Another approach was to make "baskets" filled with earth and lower them in front of the walls as well. In the modern era, "Hesco" bastions are a revival of the idea, steel basket frames covered with heavy duty fabric and filled with earth to absorb RPG fire, shockwaves from vehicle born suicide bombs and shrapnel from mortar and artillery fire, so we know this approach works.
Since there will be a lot of force on the wall, re-enforcing the inside of the wall with timber buttresses or even just logs leaning against the wall to form triangular braces will help strengthen the walls, without taking up too much of the interior space. Moving around near the wall will be more complicated by the bracing, so any reserve or sally force should be in the city square ready to race to the affected sections of the wall, rather than trying to move around the perimeter.
Traditionally, gates were the most heavily built parts of the walls, almost as strong as the keep itself. The best way to protect the gate and allow some freedom of movement would be to place a "V" shaped Ravelin ahead of the gate preventing a direct view of the entrance, which would have to be taken and demolished to allow a battery to be placed in front of the gate, but this was developed in the 1600's by Vauban, earlier versions might be detached walls or even a small, separate blockhouse type fort to shield the gate from view and fire.
The real key is the time and resources the garrison of the fortress city has. Building a full set of walls outside of the curtain wall is expensive, time consuming and impractical for most places. In real sieges, what often happened was the engineers would rapidly throw bundles of wood or soil filled baskets in front of the walls that were being fired upon (or where the engineers assessed the enemy batteries would most likely to be placed), and rush out at night to repair the damage and build up new fortifications as needed. This was feasible because the expense of the artillery train was beyond all but the wealthiest lords and even stretched the resources of most Kings, so the defender might only face one or two batteries of large and relatively immobile siege guns in this period, making the problem much more reasonable.